(()=>{var EKu=Object.create;var Fb=Object.defineProperty;var hKu=Object.getOwnPropertyDescriptor;var mKu=Object.getOwnPropertyNames;var gKu=Object.getPrototypeOf,CKu=Object.prototype.hasOwnProperty;var vp=(u=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(u,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):u)(function(u){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+u+'" is not supported')});var H=(u,e)=>()=>(u&&(e=u(u=0)),e);var Q=(u,e)=>()=>(e||u((e={exports:{}}).exports,e),e.exports),Mu=(u,e)=>{for(var t in e)Fb(u,t,{get:e[t],enumerable:!0})},_b=(u,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of mKu(e))!CKu.call(u,n)&&n!==t&&Fb(u,n,{get:()=>e[n],enumerable:!(r=hKu(e,n))||r.enumerable});return u},ot=(u,e,t)=>(_b(u,e,"default"),t&&_b(t,e,"default")),gu=(u,e,t)=>(t=u!=null?EKu(gKu(u)):{},_b(e||!u||!u.__esModule?Fb(t,"default",{value:u,enumerable:!0}):t,u)),We=u=>_b(Fb({},"__esModule",{value:!0}),u);var mN,Qru=H(()=>{mN="2.19.9"});function $ru(u,e){return e?.(u)?u:u&&typeof u=="object"&&"cause"in u?$ru(u.cause,e):e?null:u}var gN,vu,he=H(()=>{Qru();gN={getDocsUrl:({docsBaseUrl:u,docsPath:e="",docsSlug:t})=>e?`${u??"https://viem.sh"}${e}${t?`#${t}`:""}`:void 0,version:mN},vu=class u extends Error{constructor(e,t={}){let r=t.cause instanceof u?t.cause.details:t.cause?.message?t.cause.message:t.details,n=t.cause instanceof u&&t.cause.docsPath||t.docsPath,i=gN.getDocsUrl?.({...t,docsPath:n}),s=[e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...r?[`Details: ${r}`]:[],...gN.version?[`Version: ${gN.version}`]:[]].join(`
`);super(s,t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=n,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=mN}walk(e){return $ru(this,e)}}});var kb,Sb,Ib,Mb=H(()=>{he();kb=class extends vu{constructor({max:e,min:t,signed:r,size:n,value:i}){super(`Number "${i}" is not in safe ${n?`${n*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}},Sb=class extends vu{constructor(e){super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}},Ib=class extends vu{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}});var um,em,tm,Rb=H(()=>{he();um=class extends vu{constructor({offset:e,position:t,size:r}){super(`Slice ${t==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},em=class extends vu{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}},tm=class extends vu{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${t} ${r} long, but is ${e} ${r} long.`,{name:"InvalidBytesLengthError"})}}});function e3(u,{dir:e,size:t=32}={}){return typeof u=="string"?Ql(u,{dir:e,size:t}):AKu(u,{dir:e,size:t})}function Ql(u,{dir:e,size:t=32}={}){if(t===null)return u;let r=u.replace("0x","");if(r.length>t*2)throw new em({size:Math.ceil(r.length/2),targetSize:t,type:"hex"});return`0x${r[e==="right"?"padEnd":"padStart"](t*2,"0")}`}function AKu(u,{dir:e,size:t=32}={}){if(t===null)return u;if(u.length>t)throw new em({size:u.length,targetSize:t,type:"bytes"});let r=new Uint8Array(t);for(let n=0;n{Rb()});function $t(u,{strict:e=!0}={}){return!u||typeof u!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(u):u.startsWith("0x")}var Y4=H(()=>{});function Je(u){return $t(u,{strict:!1})?Math.ceil((u.length-2)/2):u.length}var na=H(()=>{Y4()});function qr(u,{dir:e="left"}={}){let t=typeof u=="string"?u.replace("0x",""):u,r=0;for(let n=0;n{});function nn(u,e={}){return typeof u=="number"||typeof u=="bigint"?bKu(u,e):typeof u=="boolean"?yKu(u,e):$t(u)?Ut(u,e):ia(u,e)}function yKu(u,e={}){let t=new Uint8Array(1);return t[0]=Number(u),typeof e.size=="number"?(ko(t,{size:e.size}),e3(t,{size:e.size})):t}function Jru(u){if(u>=$l.zero&&u<=$l.nine)return u-$l.zero;if(u>=$l.A&&u<=$l.F)return u-($l.A-10);if(u>=$l.a&&u<=$l.f)return u-($l.a-10)}function Ut(u,e={}){let t=u;e.size&&(ko(t,{size:e.size}),t=e3(t,{dir:"right",size:e.size}));let r=t.slice(2);r.length%2&&(r=`0${r}`);let n=r.length/2,i=new Uint8Array(n);for(let s=0,a=0;s{he();Y4();rm();on();L0();vKu=new TextEncoder;$l={zero:48,nine:57,A:65,F:70,a:97,f:102}});function ko(u,{size:e}){if(Je(u)>e)throw new Ib({givenSize:Je(u),maxSize:e})}function Ae(u,e={}){let{signed:t}=e;e.size&&ko(u,{size:e.size});let r=BigInt(u);if(!t)return r;let n=(u.length-2)/2,i=(1n<{Mb();na();L2();Cr()});function Gu(u,e={}){return typeof u=="number"||typeof u=="bigint"?Zu(u,e):typeof u=="string"?oa(u,e):typeof u=="boolean"?Ob(u,e):He(u,e)}function Ob(u,e={}){let t=`0x${Number(u)}`;return typeof e.size=="number"?(ko(t,{size:e.size}),e3(t,{size:e.size})):t}function He(u,e={}){let t="";for(let n=0;ni||n{Mb();rm();on();wKu=Array.from({length:256},(u,e)=>e.toString(16).padStart(2,"0"));BKu=new TextEncoder});async function nm(u,{chain:e}){let{id:t,name:r,nativeCurrency:n,rpcUrls:i,blockExplorers:s}=e;await u.request({method:"wallet_addEthereumChain",params:[{chainId:Zu(t),chainName:r,nativeCurrency:n,rpcUrls:i.default.http,blockExplorerUrls:s?Object.values(s).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}var CN=H(()=>{L0()});function $i(u,{includeName:e=!1}={}){if(u.type!=="function"&&u.type!=="event"&&u.type!=="error")throw new Pb(u.type);return`${u.name}(${im(u.inputs,{includeName:e})})`}function im(u,{includeName:e=!1}={}){return u?u.map(t=>xKu(t,{includeName:e})).join(e?", ":","):""}function xKu(u,{includeName:e}){return u.type.startsWith("tuple")?`(${im(u.components,{includeName:e})})${u.type.slice(5)}`:u.type+(e&&u.name?` ${u.name}`:"")}var A6=H(()=>{Dn()});var Nb,om,yp,t3,Lb,jb,zb,bp,Ub,wp,sm,j2,qb,Wb,Hb,sa,r3,Vb,Gb,Kb,Pb,Dn=H(()=>{A6();na();he();Nb=class extends vu{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
`),{docsPath:e,name:"AbiConstructorNotFoundError"})}},om=class extends vu{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
`),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}},yp=class extends vu{constructor({data:e,params:t,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
`),{metaMessages:[`Params: (${im(t,{includeName:!0})})`,`Data: ${e} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=t,this.size=r}},t3=class extends vu{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}},Lb=class extends vu{constructor({expectedLength:e,givenLength:t,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${e}`,`Given length: ${t}`].join(`
`),{name:"AbiEncodingArrayLengthMismatchError"})}},jb=class extends vu{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${Je(t)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}},zb=class extends vu{constructor({expectedLength:e,givenLength:t}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${t}`].join(`
`),{name:"AbiEncodingLengthMismatchError"})}},bp=class extends vu{constructor(e,{docsPath:t}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(`
`),{docsPath:t,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}},Ub=class extends vu{constructor({docsPath:e}){super("Cannot extract event signature from empty topics.",{docsPath:e,name:"AbiEventSignatureEmptyTopicsError"})}},wp=class extends vu{constructor(e,{docsPath:t}){super([`Encoded event signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join(`
`),{docsPath:t,name:"AbiEventSignatureNotFoundError"})}},sm=class extends vu{constructor(e,{docsPath:t}={}){super([`Event ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
`),{docsPath:t,name:"AbiEventNotFoundError"})}},j2=class extends vu{constructor(e,{docsPath:t}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
`),{docsPath:t,name:"AbiFunctionNotFoundError"})}},qb=class extends vu{constructor(e,{docsPath:t}){super([`Function "${e}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
`),{docsPath:t,name:"AbiFunctionOutputsNotFoundError"})}},Wb=class extends vu{constructor(e,t){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${$i(e.abiItem)}\`, and`,`\`${t.type}\` in \`${$i(t.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}},Hb=class extends vu{constructor({expectedSize:e,givenSize:t}){super(`Expected bytes${e}, got bytes${t}.`,{name:"BytesSizeMismatchError"})}},sa=class extends vu{constructor({abiItem:e,data:t,params:r,size:n}){super([`Data size of ${n} bytes is too small for non-indexed event parameters.`].join(`
`),{metaMessages:[`Params: (${im(r,{includeName:!0})})`,`Data: ${t} (${n} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e,this.data=t,this.params=r,this.size=n}},r3=class extends vu{constructor({abiItem:e,param:t}){super([`Expected a topic for indexed event parameter${t.name?` "${t.name}"`:""} on event "${$i(e,{includeName:!0})}".`].join(`
`),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e}},Vb=class extends vu{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
`),{docsPath:t,name:"InvalidAbiEncodingType"})}},Gb=class extends vu{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
`),{docsPath:t,name:"InvalidAbiDecodingType"})}},Kb=class extends vu{constructor(e){super([`Value "${e}" is not a valid array.`].join(`
`),{name:"InvalidArrayError"})}},Pb=class extends vu{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
`),{name:"InvalidDefinitionTypeError"})}}});function Ji(u){return typeof u[0]=="string"?Wr(u):DKu(u)}function DKu(u){let e=0;for(let n of u)e+=n.length;let t=new Uint8Array(e),r=0;for(let n of u)t.set(n,r),r+=n.length;return t}function Wr(u){return`0x${u.reduce((e,t)=>e+t.replace("0x",""),"")}`}var So=H(()=>{});var Ye,X4=H(()=>{he();Ye=class extends vu{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}});var z2,Zb=H(()=>{z2=class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}set(e,t){return super.set(e,t),this.maxSize&&this.size>this.maxSize&&this.delete(this.keys().next().value),this}}});function am(u){if(!Number.isSafeInteger(u)||u<0)throw new Error(`positive integer expected, not ${u}`)}function _Ku(u){return u instanceof Uint8Array||u!=null&&typeof u=="object"&&u.constructor.name==="Uint8Array"}function U2(u,...e){if(!_Ku(u))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(u.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${u.length}`)}function Yru(u){if(typeof u!="function"||typeof u.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");am(u.outputLen),am(u.blockLen)}function Jl(u,e=!0){if(u.destroyed)throw new Error("Hash instance has been destroyed");if(e&&u.finished)throw new Error("Hash#digest() has already been called")}function Qb(u,e){U2(u);let t=e.outputLen;if(u.length{});function FKu(u,e=!1){return e?{h:Number(u&$b),l:Number(u>>Xru&$b)}:{h:Number(u>>Xru&$b)|0,l:Number(u&$b)|0}}function unu(u,e=!1){let t=new Uint32Array(u.length),r=new Uint32Array(u.length);for(let n=0;n{$b=BigInt(4294967295),Xru=BigInt(32);enu=(u,e,t)=>u<>>32-t,tnu=(u,e,t)=>e<>>32-t,rnu=(u,e,t)=>e<>>64-t,nnu=(u,e,t)=>u<>>64-t});var Jb,onu=H(()=>{Jb=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});function vN(u){for(let e=0;eu().update(W2(r)).digest(),t=u();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>u(),e}function lnu(u){let e=(r,n)=>u(n).update(W2(r)).digest(),t=u({});return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=r=>u(r),e}function uw(u=32){if(Jb&&typeof Jb.getRandomValues=="function")return Jb.getRandomValues(new Uint8Array(u));throw new Error("crypto.getRandomValues must be defined")}var snu,Yb,aa,AN,kKu,q2,ON0,v6=H(()=>{onu();lm();snu=u=>new Uint32Array(u.buffer,u.byteOffset,Math.floor(u.byteLength/4)),Yb=u=>new DataView(u.buffer,u.byteOffset,u.byteLength),aa=(u,e)=>u<<32-e|u>>>e,AN=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,kKu=u=>u<<24&4278190080|u<<8&16711680|u>>>8&65280|u>>>24&255;q2=class{clone(){return this._cloneInto()}},ON0={}.toString});function LKu(u,e=24){let t=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let s=0;s<10;s++)t[s]=u[s]^u[s+10]^u[s+20]^u[s+30]^u[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,l=(s+2)%10,c=t[l],d=t[l+1],f=cnu(c,d,1)^t[a],h=dnu(c,d,1)^t[a+1];for(let g=0;g<50;g+=10)u[s+g]^=f,u[s+g+1]^=h}let n=u[2],i=u[3];for(let s=0;s<24;s++){let a=pnu[s],l=cnu(n,i,a),c=dnu(n,i,a),d=fnu[s];n=u[d],i=u[d+1],u[d]=l,u[d+1]=c}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)t[a]=u[s+a];for(let a=0;a<10;a++)u[s+a]^=~t[(a+2)%10]&t[(a+4)%10]}u[0]^=PKu[r],u[1]^=NKu[r]}t.fill(0)}var fnu,pnu,Enu,IKu,cm,MKu,RKu,TKu,OKu,PKu,NKu,cnu,dnu,ew,H2,zN0,UN0,qN0,WN0,HN0,hnu,VN0,GN0,mnu,KN0,ZN0,gnu=H(()=>{lm();inu();v6();fnu=[],pnu=[],Enu=[],IKu=BigInt(0),cm=BigInt(1),MKu=BigInt(2),RKu=BigInt(7),TKu=BigInt(256),OKu=BigInt(113);for(let u=0,e=cm,t=1,r=0;u<24;u++){[t,r]=[r,(2*t+3*r)%5],fnu.push(2*(5*r+t)),pnu.push((u+1)*(u+2)/2%64);let n=IKu;for(let i=0;i<7;i++)e=(e<>RKu)*OKu)%TKu,e&MKu&&(n^=cm<<(cm<t>32?rnu(u,e,t):enu(u,e,t),dnu=(u,e,t)=>t>32?nnu(u,e,t):tnu(u,e,t);ew=class u extends q2{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,am(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=snu(this.state)}keccak(){AN||vN(this.state32),LKu(this.state32,this.rounds),AN||vN(this.state32),this.posOut=0,this.pos=0}update(e){Jl(this);let{blockLen:t,state:r}=this;e=W2(e);let n=e.length;for(let i=0;i=r&&this.keccak();let s=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+s),n),this.posOut+=s,n+=s}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return am(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Qb(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:s}=this;return e||(e=new u(t,r,n,s,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=s,e.destroyed=this.destroyed,e}},H2=(u,e,t)=>Xb(()=>new ew(e,u,t)),zN0=H2(6,144,224/8),UN0=H2(6,136,256/8),qN0=H2(6,104,384/8),WN0=H2(6,72,512/8),HN0=H2(1,144,224/8),hnu=H2(1,136,256/8),VN0=H2(1,104,384/8),GN0=H2(1,72,512/8),mnu=(u,e,t)=>lnu((r={})=>new ew(e,u,r.dkLen===void 0?t:r.dkLen,!0)),KN0=mnu(31,168,128/8),ZN0=mnu(31,136,256/8)});function pt(u,e){let t=e||"hex",r=hnu($t(u,{strict:!1})?nn(u):u);return t==="bytes"?r:Gu(r)}var us=H(()=>{gnu();Y4();Cr();L0()});function n3(u,e){if(yN.has(`${u}.${e}`))return yN.get(`${u}.${e}`);let t=e?`${e}${u.toLowerCase()}`:u.substring(2).toLowerCase(),r=pt(ia(t),"bytes"),n=(e?t.substring(`${e}0x`.length):t).split("");for(let s=0;s<40;s+=2)r[s>>1]>>4>=8&&n[s]&&(n[s]=n[s].toUpperCase()),(r[s>>1]&15)>=8&&n[s+1]&&(n[s+1]=n[s+1].toUpperCase());let i=`0x${n.join("")}`;return yN.set(`${u}.${e}`,i),i}function It(u,e){if(!ve(u,{strict:!1}))throw new Ye({address:u});return n3(u,e)}var yN,Yl=H(()=>{X4();Cr();us();Zb();Io();yN=new z2(8192)});function ve(u,e){let{strict:t=!0}=e??{},r=`${u}.${t}`;if(bN.has(r))return bN.get(r);let n=jKu.test(u)?u.toLowerCase()===u?!0:t?n3(u)===u:!0:!1;return bN.set(r,n),n}var jKu,bN,Io=H(()=>{Zb();Yl();jKu=/^0x[a-fA-F0-9]{40}$/,bN=new z2(8192)});function Xl(u,e,t,{strict:r}={}){return $t(u,{strict:!1})?BN(u,e,t,{strict:r}):wN(u,e,t,{strict:r})}function Cnu(u,e){if(typeof e=="number"&&e>0&&e>Je(u)-1)throw new um({offset:e,position:"start",size:Je(u)})}function Anu(u,e,t){if(typeof e=="number"&&typeof t=="number"&&Je(u)!==t-e)throw new um({offset:t,position:"end",size:Je(u)})}function wN(u,e,t,{strict:r}={}){Cnu(u,e);let n=u.slice(e,t);return r&&Anu(n,e,t),n}function BN(u,e,t,{strict:r}={}){Cnu(u,e);let n=`0x${u.replace("0x","").slice((e??0)*2,(t??u.length)*2)}`;return r&&Anu(n,e,t),n}var y6=H(()=>{Rb();Y4();na()});function g4(u,e){if(u.length!==e.length)throw new zb({expectedLength:u.length,givenLength:e.length});let t=zKu({params:u,values:e}),r=DN(t);return r.length===0?"0x":r}function zKu({params:u,values:e}){let t=[];for(let r=0;r0?Ji([a,s]):a}}if(n)return{dynamic:!0,encoded:s}}return{dynamic:!1,encoded:Ji(i.map(({encoded:s})=>s))}}function WKu(u,{param:e}){let[,t]=e.type.split("bytes"),r=Je(u);if(!t){let n=u;return r%32!==0&&(n=Ql(n,{dir:"right",size:Math.ceil((u.length-2)/2/32)*32})),{dynamic:!0,encoded:Ji([Ql(Zu(r,{size:32})),n])}}if(r!==Number.parseInt(t))throw new jb({expectedSize:Number.parseInt(t),value:u});return{dynamic:!1,encoded:Ql(u,{dir:"right"})}}function HKu(u){if(typeof u!="boolean")throw new vu(`Invalid boolean value: "${u}" (type: ${typeof u}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Ql(Ob(u))}}function VKu(u,{signed:e}){return{dynamic:!1,encoded:Zu(u,{size:32,signed:e})}}function GKu(u){let e=oa(u),t=Math.ceil(Je(e)/32),r=[];for(let n=0;nn))}}function tw(u){let e=u.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}var V2=H(()=>{Dn();X4();he();Io();So();rm();na();y6();L0()});function b6(u){let{abi:e,args:t,bytecode:r}=u;if(!t||t.length===0)return r;let n=e.find(s=>"type"in s&&s.type==="constructor");if(!n)throw new Nb({docsPath:_N});if(!("inputs"in n))throw new om({docsPath:_N});if(!n.inputs||n.inputs.length===0)throw new om({docsPath:_N});let i=g4(n.inputs,t);return Wr([r,i])}var _N,rw=H(()=>{Dn();So();V2();_N="/docs/contract/encodeDeployData"});function Et(u){return typeof u=="string"?{address:u,type:"json-rpc"}:u}var Yi=H(()=>{});var es,Bp,xp=H(()=>{he();es=class extends vu{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(`
`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}},Bp=class extends vu{constructor({docsPath:e,metaMessages:t,type:r}){super(`Account type "${r}" is not supported.`,{docsPath:e,metaMessages:t,name:"AccountTypeNotSupportedError"})}}});function vnu(u){let e=pt(`0x${u.substring(4)}`).substring(26);return n3(`0x${e}`)}var ynu=H(()=>{Yl();us()});function ZKu(u,e,t,r){if(typeof u.setBigUint64=="function")return u.setBigUint64(e,t,r);let n=BigInt(32),i=BigInt(4294967295),s=Number(t>>n&i),a=Number(t&i),l=r?4:0,c=r?0:4;u.setUint32(e+l,s,r),u.setUint32(e+c,a,r)}var bnu,wnu,nw,Bnu=H(()=>{lm();v6();bnu=(u,e,t)=>u&e^~u&t,wnu=(u,e,t)=>u&e^u&t^e&t,nw=class extends q2{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Yb(this.buffer)}update(e){Jl(this);let{view:t,buffer:r,blockLen:n}=this;e=W2(e);let i=e.length;for(let s=0;sn-s&&(this.process(r,0),s=0);for(let f=s;fd.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f{Bnu();v6();QKu=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),G2=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),K2=new Uint32Array(64),FN=class extends nw{constructor(){super(64,32,8,!1),this.A=G2[0]|0,this.B=G2[1]|0,this.C=G2[2]|0,this.D=G2[3]|0,this.E=G2[4]|0,this.F=G2[5]|0,this.G=G2[6]|0,this.H=G2[7]|0}get(){let{A:e,B:t,C:r,D:n,E:i,F:s,G:a,H:l}=this;return[e,t,r,n,i,s,a,l]}set(e,t,r,n,i,s,a,l){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=i|0,this.F=s|0,this.G=a|0,this.H=l|0}process(e,t){for(let f=0;f<16;f++,t+=4)K2[f]=e.getUint32(t,!1);for(let f=16;f<64;f++){let h=K2[f-15],g=K2[f-2],v=aa(h,7)^aa(h,18)^h>>>3,D=aa(g,17)^aa(g,19)^g>>>10;K2[f]=D+K2[f-7]+v+K2[f-16]|0}let{A:r,B:n,C:i,D:s,E:a,F:l,G:c,H:d}=this;for(let f=0;f<64;f++){let h=aa(a,6)^aa(a,11)^aa(a,25),g=d+h+bnu(a,l,c)+QKu[f]+K2[f]|0,D=(aa(r,2)^aa(r,13)^aa(r,22))+wnu(r,n,i)|0;d=c,c=l,l=a,a=s+g|0,s=i,i=n,n=r,r=g+D|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,s=s+this.D|0,a=a+this.E|0,l=l+this.F|0,c=c+this.G|0,d=d+this.H|0,this.set(r,n,i,s,a,l,c,d)}roundClean(){K2.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},w6=Xb(()=>new FN)});var TN={};Mu(TN,{abytes:()=>ts,bitGet:()=>uZu,bitLen:()=>XKu,bitMask:()=>fm,bitSet:()=>eZu,bytesToHex:()=>B6,bytesToNumberBE:()=>sn,bytesToNumberLE:()=>ow,concatBytes:()=>Ei,createHmacDrbg:()=>RN,ensureBytes:()=>an,equalBytes:()=>MN,hexToBytes:()=>x6,hexToNumber:()=>IN,isBytes:()=>Z2,numberToBytesBE:()=>la,numberToBytesLE:()=>sw,numberToHexUnpadded:()=>Fnu,numberToVarBytesBE:()=>YKu,utf8ToBytes:()=>dm,validateObject:()=>i3});function Z2(u){return u instanceof Uint8Array||u!=null&&typeof u=="object"&&u.constructor.name==="Uint8Array"}function ts(u){if(!Z2(u))throw new Error("Uint8Array expected")}function B6(u){ts(u);let e="";for(let t=0;t=uc._0&&u<=uc._9)return u-uc._0;if(u>=uc._A&&u<=uc._F)return u-(uc._A-10);if(u>=uc._a&&u<=uc._f)return u-(uc._a-10)}function x6(u){if(typeof u!="string")throw new Error("hex string expected, got "+typeof u);let e=u.length,t=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let r=new Uint8Array(t);for(let n=0,i=0;n_nu;u>>=iw,e+=1);return e}function uZu(u,e){return u>>BigInt(e)&iw}function eZu(u,e,t){return u|(t?iw:_nu)<{r.fill(1),n.fill(0),i=0},a=(...f)=>t(n,r,...f),l=(f=SN())=>{n=a(Dnu([0]),f),r=a(),f.length!==0&&(n=a(Dnu([1]),f),r=a())},c=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let f=0,h=[];for(;f{s(),l(f);let g;for(;!(g=h(c()));)l();return s(),g}}function i3(u,e,t={}){let r=(n,i,s)=>{let a=tZu[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);let l=u[n];if(!(s&&l===void 0)&&!a(l,u))throw new Error(`Invalid param ${String(n)}=${l} (${typeof l}), expected ${i}`)};for(let[n,i]of Object.entries(e))r(n,i,!1);for(let[n,i]of Object.entries(t))r(n,i,!0);return u}var _nu,iw,$Ku,JKu,uc,fm,SN,Dnu,tZu,Q2=H(()=>{_nu=BigInt(0),iw=BigInt(1),$Ku=BigInt(2);JKu=Array.from({length:256},(u,e)=>e.toString(16).padStart(2,"0"));uc={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};fm=u=>($Ku<new Uint8Array(u),Dnu=u=>Uint8Array.from(u);tZu={bigint:u=>typeof u=="bigint",function:u=>typeof u=="function",boolean:u=>typeof u=="boolean",string:u=>typeof u=="string",stringOrUint8Array:u=>typeof u=="string"||Z2(u),isSafeInteger:u=>Number.isSafeInteger(u),array:u=>Array.isArray(u),field:(u,e)=>e.Fp.isValid(u),hash:u=>typeof u=="function"&&Number.isSafeInteger(u.outputLen)}});function Ir(u,e){let t=u%e;return t>=ln?t:e+t}function oZu(u,e,t){if(t<=ln||e 0");if(t===Ar)return ln;let r=Ar;for(;e>ln;)e&Ar&&(r=r*u%t),u=u*u%t,e>>=Ar;return r}function C4(u,e,t){let r=u;for(;e-- >ln;)r*=r,r%=t;return r}function aw(u,e){if(u===ln||e<=ln)throw new Error(`invert: expected positive integers, got n=${u} mod=${e}`);let t=Ir(u,e),r=e,n=ln,i=Ar,s=Ar,a=ln;for(;t!==ln;){let c=r/t,d=r%t,f=n-s*c,h=i-a*c;r=t,t=d,n=s,i=a,s=f,a=h}if(r!==Ar)throw new Error("invert: does not exist");return Ir(n,e)}function sZu(u){let e=(u-Ar)/D6,t,r,n;for(t=u-Ar,r=0;t%D6===ln;t/=D6,r++);for(n=D6;n(r[n]="function",r),e);return i3(u,t)}function cZu(u,e,t){if(t 0");if(t===ln)return u.ONE;if(t===Ar)return e;let r=u.ONE,n=e;for(;t>ln;)t&Ar&&(r=u.mul(r,n)),n=u.sqr(n),t>>=Ar;return r}function dZu(u,e){let t=new Array(e.length),r=e.reduce((i,s,a)=>u.is0(s)?i:(t[a]=i,u.mul(i,s)),u.ONE),n=u.inv(r);return e.reduceRight((i,s,a)=>u.is0(s)?i:(t[a]=u.mul(i,t[a]),u.mul(i,s)),n),t}function PN(u,e){let t=e!==void 0?e:u.toString(2).length,r=Math.ceil(t/8);return{nBitLength:t,nByteLength:r}}function Inu(u,e,t=!1,r={}){if(u<=ln)throw new Error(`Expected Field ORDER > 0, got ${u}`);let{nBitLength:n,nByteLength:i}=PN(u,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=aZu(u),a=Object.freeze({ORDER:u,BITS:n,BYTES:i,MASK:fm(n),ZERO:ln,ONE:Ar,create:l=>Ir(l,u),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return ln<=l&&ll===ln,isOdd:l=>(l&Ar)===Ar,neg:l=>Ir(-l,u),eql:(l,c)=>l===c,sqr:l=>Ir(l*l,u),add:(l,c)=>Ir(l+c,u),sub:(l,c)=>Ir(l-c,u),mul:(l,c)=>Ir(l*c,u),pow:(l,c)=>cZu(a,l,c),div:(l,c)=>Ir(l*aw(c,u),u),sqrN:l=>l*l,addN:(l,c)=>l+c,subN:(l,c)=>l-c,mulN:(l,c)=>l*c,inv:l=>aw(l,u),sqrt:r.sqrt||(l=>s(a,l)),invertBatch:l=>dZu(a,l),cmov:(l,c,d)=>d?c:l,toBytes:l=>t?sw(l,i):la(l,i),fromBytes:l=>{if(l.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${l.length}`);return t?ow(l):sn(l)}});return Object.freeze(a)}function Mnu(u){if(typeof u!="bigint")throw new Error("field order must be bigint");let e=u.toString(2).length;return Math.ceil(e/8)}function NN(u){let e=Mnu(u);return e+Math.ceil(e/2)}function Rnu(u,e,t=!1){let r=u.length,n=Mnu(e),i=NN(e);if(r<16||r1024)throw new Error(`expected ${i}-1024 bytes of input, got ${r}`);let s=t?sn(u):ow(u),a=Ir(s,e-Ar)+Ar;return t?sw(a,n):la(a,n)}var ln,Ar,D6,rZu,ON,knu,Snu,nZu,iZu,lZu,pm=H(()=>{Q2();ln=BigInt(0),Ar=BigInt(1),D6=BigInt(2),rZu=BigInt(3),ON=BigInt(4),knu=BigInt(5),Snu=BigInt(8),nZu=BigInt(9),iZu=BigInt(16);lZu=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"]});function Tnu(u,e){let t=(n,i)=>{let s=i.negate();return n?s:i},r=n=>{let i=Math.ceil(e/n)+1,s=2**(n-1);return{windows:i,windowSize:s}};return{constTimeNegate:t,unsafeLadder(n,i){let s=u.ZERO,a=n;for(;i>pZu;)i&LN&&(s=s.add(a)),a=a.double(),i>>=LN;return s},precomputeWindow(n,i){let{windows:s,windowSize:a}=r(i),l=[],c=n,d=c;for(let f=0;f>=g,F>l&&(F-=h,s+=LN);let w=D,x=D+Math.abs(F)-1,M=v%2!==0,T=F<0;F===0?d=d.add(t(M,i[w])):c=c.add(t(T,i[x]))}return{p:c,f:d}},wNAFCached(n,i,s,a){let l=n._WINDOW_SIZE||1,c=i.get(n);return c||(c=this.precomputeWindow(n,l),l!==1&&i.set(n,a(c))),this.wNAF(l,c,s)}}}function jN(u){return lw(u.Fp),i3(u,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...PN(u.n,u.nBitLength),...u,p:u.Fp.ORDER})}var pZu,LN,Onu=H(()=>{pm();Q2();pZu=BigInt(0),LN=BigInt(1)});function EZu(u){let e=jN(u);i3(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:t,Fp:r,a:n}=e;if(t){if(!r.eql(n,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}function gZu(u){let e=EZu(u),{Fp:t}=e,r=e.toBytes||((v,D,F)=>{let w=D.toAffine();return Ei(Uint8Array.from([4]),t.toBytes(w.x),t.toBytes(w.y))}),n=e.fromBytes||(v=>{let D=v.subarray(1),F=t.fromBytes(D.subarray(0,t.BYTES)),w=t.fromBytes(D.subarray(t.BYTES,2*t.BYTES));return{x:F,y:w}});function i(v){let{a:D,b:F}=e,w=t.sqr(v),x=t.mul(w,v);return t.add(t.add(x,t.mul(v,D)),F)}if(!t.eql(t.sqr(e.Gy),i(e.Gx)))throw new Error("bad generator point: equation left != right");function s(v){return typeof v=="bigint"&&cat.eql(M,t.ZERO);return x(F)&&x(w)?f.ZERO:new f(F,w,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(D){let F=t.invertBatch(D.map(w=>w.pz));return D.map((w,x)=>w.toAffine(F[x])).map(f.fromAffine)}static fromHex(D){let F=f.fromAffine(n(an("pointHex",D)));return F.assertValidity(),F}static fromPrivateKey(D){return f.BASE.multiply(l(D))}_setWindowSize(D){this._WINDOW_SIZE=D,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:D,y:F}=this.toAffine();if(!t.isValid(D)||!t.isValid(F))throw new Error("bad point: x or y not FE");let w=t.sqr(F),x=i(D);if(!t.eql(w,x))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:D}=this.toAffine();if(t.isOdd)return!t.isOdd(D);throw new Error("Field doesn't support isOdd")}equals(D){d(D);let{px:F,py:w,pz:x}=this,{px:M,py:T,pz:L}=D,j=t.eql(t.mul(F,L),t.mul(M,x)),P=t.eql(t.mul(w,L),t.mul(T,x));return j&&P}negate(){return new f(this.px,t.neg(this.py),this.pz)}double(){let{a:D,b:F}=e,w=t.mul(F,cw),{px:x,py:M,pz:T}=this,L=t.ZERO,j=t.ZERO,P=t.ZERO,z=t.mul(x,x),U=t.mul(M,M),V=t.mul(T,T),q=t.mul(x,M);return q=t.add(q,q),P=t.mul(x,T),P=t.add(P,P),L=t.mul(D,P),j=t.mul(w,V),j=t.add(L,j),L=t.sub(U,j),j=t.add(U,j),j=t.mul(L,j),L=t.mul(q,L),P=t.mul(w,P),V=t.mul(D,V),q=t.sub(z,V),q=t.mul(D,q),q=t.add(q,P),P=t.add(z,z),z=t.add(P,z),z=t.add(z,V),z=t.mul(z,q),j=t.add(j,z),V=t.mul(M,T),V=t.add(V,V),z=t.mul(V,q),L=t.sub(L,z),P=t.mul(V,U),P=t.add(P,P),P=t.add(P,P),new f(L,j,P)}add(D){d(D);let{px:F,py:w,pz:x}=this,{px:M,py:T,pz:L}=D,j=t.ZERO,P=t.ZERO,z=t.ZERO,U=e.a,V=t.mul(e.b,cw),q=t.mul(F,M),Z=t.mul(w,T),E=t.mul(x,L),m=t.add(F,w),y=t.add(M,T);m=t.mul(m,y),y=t.add(q,Z),m=t.sub(m,y),y=t.add(F,x);let _=t.add(M,L);return y=t.mul(y,_),_=t.add(q,E),y=t.sub(y,_),_=t.add(w,x),j=t.add(T,L),_=t.mul(_,j),j=t.add(Z,E),_=t.sub(_,j),z=t.mul(U,y),j=t.mul(V,E),z=t.add(j,z),j=t.sub(Z,z),z=t.add(Z,z),P=t.mul(j,z),Z=t.add(q,q),Z=t.add(Z,q),E=t.mul(U,E),y=t.mul(V,y),Z=t.add(Z,E),E=t.sub(q,E),E=t.mul(U,E),y=t.add(y,E),q=t.mul(Z,y),P=t.add(P,q),q=t.mul(_,y),j=t.mul(m,j),j=t.sub(j,q),q=t.mul(m,Z),z=t.mul(_,z),z=t.add(z,q),new f(j,P,z)}subtract(D){return this.add(D.negate())}is0(){return this.equals(f.ZERO)}wNAF(D){return g.wNAFCached(this,c,D,F=>{let w=t.invertBatch(F.map(x=>x.pz));return F.map((x,M)=>x.toAffine(w[M])).map(f.fromAffine)})}multiplyUnsafe(D){let F=f.ZERO;if(D===ca)return F;if(a(D),D===vr)return this;let{endo:w}=e;if(!w)return g.unsafeLadder(this,D);let{k1neg:x,k1:M,k2neg:T,k2:L}=w.splitScalar(D),j=F,P=F,z=this;for(;M>ca||L>ca;)M&vr&&(j=j.add(z)),L&vr&&(P=P.add(z)),z=z.double(),M>>=vr,L>>=vr;return x&&(j=j.negate()),T&&(P=P.negate()),P=new f(t.mul(P.px,w.beta),P.py,P.pz),j.add(P)}multiply(D){a(D);let F=D,w,x,{endo:M}=e;if(M){let{k1neg:T,k1:L,k2neg:j,k2:P}=M.splitScalar(F),{p:z,f:U}=this.wNAF(L),{p:V,f:q}=this.wNAF(P);z=g.constTimeNegate(T,z),V=g.constTimeNegate(j,V),V=new f(t.mul(V.px,M.beta),V.py,V.pz),w=z.add(V),x=U.add(q)}else{let{p:T,f:L}=this.wNAF(F);w=T,x=L}return f.normalizeZ([w,x])[0]}multiplyAndAddUnsafe(D,F,w){let x=f.BASE,M=(L,j)=>j===ca||j===vr||!L.equals(x)?L.multiplyUnsafe(j):L.multiply(j),T=M(this,F).add(M(D,w));return T.is0()?void 0:T}toAffine(D){let{px:F,py:w,pz:x}=this,M=this.is0();D==null&&(D=M?t.ONE:t.inv(x));let T=t.mul(F,D),L=t.mul(w,D),j=t.mul(x,D);if(M)return{x:t.ZERO,y:t.ZERO};if(!t.eql(j,t.ONE))throw new Error("invZ was invalid");return{x:T,y:L}}isTorsionFree(){let{h:D,isTorsionFree:F}=e;if(D===vr)return!0;if(F)return F(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:D,clearCofactor:F}=e;return D===vr?this:F?F(f,this):this.multiplyUnsafe(e.h)}toRawBytes(D=!0){return this.assertValidity(),r(f,this,D)}toHex(D=!0){return B6(this.toRawBytes(D))}}f.BASE=new f(e.Gx,e.Gy,t.ONE),f.ZERO=new f(t.ZERO,t.ONE,t.ZERO);let h=e.nBitLength,g=Tnu(f,e.endo?Math.ceil(h/2):h);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:l,weierstrassEquation:i,isWithinCurveOrder:s}}function CZu(u){let e=jN(u);return i3(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Nnu(u){let e=CZu(u),{Fp:t,n:r}=e,n=t.BYTES+1,i=2*t.BYTES+1;function s(y){return caB6(la(y,e.nByteLength));function v(y){let _=r>>vr;return y>_}function D(y){return v(y)?a(-y):y}let F=(y,_,k)=>sn(y.slice(_,k));class w{constructor(_,k,O){this.r=_,this.s=k,this.recovery=O,this.assertValidity()}static fromCompact(_){let k=e.nByteLength;return _=an("compactSignature",_,k*2),new w(F(_,0,k),F(_,k,2*k))}static fromDER(_){let{r:k,s:O}=_6.toSig(an("DER",_));return new w(k,O)}assertValidity(){if(!h(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!h(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(_){return new w(this.r,this.s,_)}recoverPublicKey(_){let{r:k,s:O,recovery:N}=this,R=P(an("msgHash",_));if(N==null||![0,1,2,3].includes(N))throw new Error("recovery id invalid");let A=N===2||N===3?k+e.n:k;if(A>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");let B=N&1?"03":"02",G=c.fromHex(B+g(A)),X=l(A),S=a(-R*X),K=a(O*X),J=c.BASE.multiplyAndAddUnsafe(G,S,K);if(!J)throw new Error("point at infinify");return J.assertValidity(),J}hasHighS(){return v(this.s)}normalizeS(){return this.hasHighS()?new w(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return x6(this.toDERHex())}toDERHex(){return _6.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return x6(this.toCompactHex())}toCompactHex(){return g(this.r)+g(this.s)}}let x={isValidPrivateKey(y){try{return d(y),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{let y=NN(e.n);return Rnu(e.randomBytes(y),e.n)},precompute(y=8,_=c.BASE){return _._setWindowSize(y),_.multiply(BigInt(3)),_}};function M(y,_=!0){return c.fromPrivateKey(y).toRawBytes(_)}function T(y){let _=Z2(y),k=typeof y=="string",O=(_||k)&&y.length;return _?O===n||O===i:k?O===2*n||O===2*i:y instanceof c}function L(y,_,k=!0){if(T(y))throw new Error("first arg must be private key");if(!T(_))throw new Error("second arg must be public key");return c.fromHex(_).multiply(d(y)).toRawBytes(k)}let j=e.bits2int||function(y){let _=sn(y),k=y.length*8-e.nBitLength;return k>0?_>>BigInt(k):_},P=e.bits2int_modN||function(y){return a(j(y))},z=fm(e.nBitLength);function U(y){if(typeof y!="bigint")throw new Error("bigint expected");if(!(ca<=y&&yau in k))throw new Error("sign() legacy options not supported");let{hash:O,randomBytes:N}=e,{lowS:R,prehash:A,extraEntropy:B}=k;R==null&&(R=!0),y=an("msgHash",y),A&&(y=an("prehashed msgHash",O(y)));let G=P(y),X=d(_),S=[U(X),U(G)];if(B!=null&&B!==!1){let au=B===!0?N(t.BYTES):B;S.push(an("extraEntropy",au))}let K=Ei(...S),J=G;function uu(au){let lu=j(au);if(!h(lu))return;let iu=l(lu),cu=c.BASE.multiply(lu).toAffine(),Cu=a(cu.x);if(Cu===ca)return;let su=a(iu*a(J+Cu*X));if(su===ca)return;let yu=(cu.x===Cu?0:2)|Number(cu.y&vr),o0=su;return R&&v(su)&&(o0=D(su),yu^=1),new w(Cu,o0,yu)}return{seed:K,k2sig:uu}}let q={lowS:e.lowS,prehash:!1},Z={lowS:e.lowS,prehash:!1};function E(y,_,k=q){let{seed:O,k2sig:N}=V(y,_,k),R=e;return RN(R.hash.outputLen,R.nByteLength,R.hmac)(O,N)}c.BASE._setWindowSize(8);function m(y,_,k,O=Z){let N=y;if(_=an("msgHash",_),k=an("publicKey",k),"strict"in O)throw new Error("options.strict was renamed to lowS");let{lowS:R,prehash:A}=O,B,G;try{if(typeof N=="string"||Z2(N))try{B=w.fromDER(N)}catch(cu){if(!(cu instanceof _6.Err))throw cu;B=w.fromCompact(N)}else if(typeof N=="object"&&typeof N.r=="bigint"&&typeof N.s=="bigint"){let{r:cu,s:Cu}=N;B=new w(cu,Cu)}else throw new Error("PARSE");G=c.fromHex(k)}catch(cu){if(cu.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(R&&B.hasHighS())return!1;A&&(_=e.hash(_));let{r:X,s:S}=B,K=P(_),J=l(S),uu=a(K*J),au=a(X*J),lu=c.BASE.multiplyAndAddUnsafe(G,uu,au)?.toAffine();return lu?a(lu.x)===X:!1}return{CURVE:e,getPublicKey:M,getSharedSecret:L,sign:E,verify:m,ProjectivePoint:c,Signature:w,utils:x}}function AZu(u,e){let t=u.ORDER,r=ca;for(let v=t-vr;v%$2===ca;v/=$2)r+=vr;let n=r,i=$2<{let F=f,w=u.pow(D,c),x=u.sqr(w);x=u.mul(x,D);let M=u.mul(v,x);M=u.pow(M,l),M=u.mul(M,w),w=u.mul(M,D),x=u.mul(M,v);let T=u.mul(x,w);M=u.pow(T,d);let L=u.eql(M,u.ONE);w=u.mul(x,h),M=u.mul(T,F),x=u.cmov(w,x,L),T=u.cmov(M,T,L);for(let j=n;j>vr;j--){let P=j-$2;P=$2<{let x=u.sqr(w),M=u.mul(F,w);x=u.mul(x,M);let T=u.pow(x,v);T=u.mul(T,M);let L=u.mul(T,D),j=u.mul(u.sqr(T),w),P=u.eql(j,F),z=u.cmov(L,T,P);return{isValid:P,value:z}}}return g}function Lnu(u,e){if(lw(u),!u.isValid(e.A)||!u.isValid(e.B)||!u.isValid(e.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");let t=AZu(u,e.Z);if(!u.isOdd)throw new Error("Fp.isOdd is not implemented!");return r=>{let n,i,s,a,l,c,d,f;n=u.sqr(r),n=u.mul(n,e.Z),i=u.sqr(n),i=u.add(i,n),s=u.add(i,u.ONE),s=u.mul(s,e.B),a=u.cmov(e.Z,u.neg(i),!u.eql(i,u.ZERO)),a=u.mul(a,e.A),i=u.sqr(s),c=u.sqr(a),l=u.mul(c,e.A),i=u.add(i,l),i=u.mul(i,s),c=u.mul(c,a),l=u.mul(c,e.B),i=u.add(i,l),d=u.mul(n,s);let{isValid:h,value:g}=t(i,c);f=u.mul(n,r),f=u.mul(f,g),d=u.cmov(d,s,h),f=u.cmov(f,g,h);let v=u.isOdd(r)===u.isOdd(f);return f=u.cmov(u.neg(f),f,v),d=u.div(d,a),{x:d,y:f}}}var hZu,mZu,_6,ca,vr,$2,cw,Pnu,zN=H(()=>{pm();Q2();Q2();Onu();({bytesToNumberBE:hZu,hexToBytes:mZu}=TN),_6={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(u){let{Err:e}=_6;if(u.length<2||u[0]!==2)throw new e("Invalid signature integer tag");let t=u[1],r=u.subarray(2,t+2);if(!t||r.length!==t)throw new e("Invalid signature integer: wrong length");if(r[0]&128)throw new e("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:hZu(r),l:u.subarray(t+2)}},toSig(u){let{Err:e}=_6,t=typeof u=="string"?mZu(u):u;ts(t);let r=t.length;if(r<2||t[0]!=48)throw new e("Invalid signature tag");if(t[1]!==r-2)throw new e("Invalid signature: incorrect length");let{d:n,l:i}=_6._parseInt(t.subarray(2)),{d:s,l:a}=_6._parseInt(i);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:n,s}},hexFromSig(u){let e=c=>Number.parseInt(c[0],16)&8?"00"+c:c,t=c=>{let d=c.toString(16);return d.length&1?`0${d}`:d},r=e(t(u.s)),n=e(t(u.r)),i=r.length/2,s=n.length/2,a=t(i),l=t(s);return`30${t(s+i+4)}02${l}${n}02${a}${r}`}},ca=BigInt(0),vr=BigInt(1),$2=BigInt(2),cw=BigInt(3),Pnu=BigInt(4)});function J2(u,e){if(u<0||u>=1<<8*e)throw new Error(`bad I2OSP call: value=${u} length=${e}`);let t=Array.from({length:e}).fill(0);for(let r=e-1;r>=0;r--)t[r]=u&255,u>>>=8;return new Uint8Array(t)}function yZu(u,e){let t=new Uint8Array(u.length);for(let r=0;r255&&(e=r(Ei(dm("H2C-OVERSIZE-DST-"),e)));let{outputLen:n,blockLen:i}=r,s=Math.ceil(t/n);if(s>255)throw new Error("Invalid xmd length");let a=Ei(e,J2(e.length,1)),l=J2(0,i),c=J2(t,2),d=new Array(s),f=r(Ei(l,u,c,J2(0,1),a));d[0]=r(Ei(f,J2(1,1),a));for(let g=1;g<=s;g++){let v=[yZu(f,d[g-1]),J2(g+1,1),a];d[g]=r(Ei(...v))}return Ei(...d).slice(0,t)}function wZu(u,e,t,r,n){if(ts(u),ts(e),UN(t),e.length>255){let i=Math.ceil(2*r/8);e=n.create({dkLen:i}).update(dm("H2C-OVERSIZE-DST-")).update(e).digest()}if(t>65535||e.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return n.create({dkLen:t}).update(u).update(J2(t,2)).update(e).update(J2(e.length,1)).digest()}function jnu(u,e,t){i3(t,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});let{p:r,k:n,m:i,hash:s,expand:a,DST:l}=t;ts(u),UN(e);let c=typeof l=="string"?dm(l):l,d=r.toString(2).length,f=Math.ceil((d+n)/8),h=e*i*f,g;if(a==="xmd")g=bZu(u,c,h,s);else if(a==="xof")g=wZu(u,c,h,n,s);else if(a==="_internal_pass")g=u;else throw new Error('expand must be "xmd" or "xof"');let v=new Array(e);for(let D=0;DArray.from(r).reverse());return(r,n)=>{let[i,s,a,l]=t.map(c=>c.reduce((d,f)=>u.add(u.mul(d,r),f)));return r=u.div(i,s),n=u.mul(n,u.div(a,l)),{x:r,y:n}}}function Unu(u,e,t){if(typeof e!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(r,n){let i=jnu(r,2,{...t,DST:t.DST,...n}),s=u.fromAffine(e(i[0])),a=u.fromAffine(e(i[1])),l=s.add(a).clearCofactor();return l.assertValidity(),l},encodeToCurve(r,n){let i=jnu(r,1,{...t,DST:t.encodeDST,...n}),s=u.fromAffine(e(i[0])).clearCofactor();return s.assertValidity(),s}}}var vZu,qnu=H(()=>{pm();Q2();vZu=sn});var dw,qN,Wnu=H(()=>{lm();v6();dw=class extends q2{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,Yru(e);let r=W2(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?e.create().update(r).digest():r);for(let s=0;snew dw(u,e).update(t).digest();qN.create=(u,e)=>new dw(u,e)});function BZu(u){return{hash:u,hmac:(e,...t)=>qN(u,e,anu(...t)),randomBytes:uw}}function Hnu(u,e){let t=r=>Nnu({...u,...BZu(r)});return Object.freeze({...t(e),create:t})}var Vnu=H(()=>{Wnu();v6();zN();});var eiu={};Mu(eiu,{encodeToCurve:()=>RZu,hashToCurve:()=>MZu,schnorr:()=>kZu,secp256k1:()=>F6});function Qnu(u){let e=hw,t=BigInt(3),r=BigInt(6),n=BigInt(11),i=BigInt(22),s=BigInt(23),a=BigInt(44),l=BigInt(88),c=u*u*u%e,d=c*c*u%e,f=C4(d,t,e)*d%e,h=C4(f,t,e)*d%e,g=C4(h,pw,e)*c%e,v=C4(g,n,e)*g%e,D=C4(v,i,e)*v%e,F=C4(D,a,e)*D%e,w=C4(F,l,e)*F%e,x=C4(w,a,e)*D%e,M=C4(x,t,e)*d%e,T=C4(M,s,e)*v%e,L=C4(T,r,e)*c%e,j=C4(L,pw,e);if(!Y2.eql(Y2.sqr(j),u))throw new Error("Cannot find square root");return j}function Ew(u,...e){let t=Knu[u];if(t===void 0){let r=w6(Uint8Array.from(u,n=>n.charCodeAt(0)));t=Ei(r,r),Knu[u]=t}return w6(Ei(t,...e))}function VN(u){let e=F6.utils.normPrivateKeyToScalar(u),t=KN.fromPrivateKey(e);return{scalar:t.hasEvenY()?e:Em(-e),bytes:GN(t)}}function Jnu(u){if(!$nu(u))throw new Error("bad x: need 0 < x < p");let e=WN(u*u),t=WN(e*u+BigInt(7)),r=Qnu(t);r%pw!==mw&&(r=WN(-r));let n=new KN(u,r,Znu);return n.assertValidity(),n}function Ynu(...u){return Em(sn(Ew("BIP0340/challenge",...u)))}function _Zu(u){return VN(u).bytes}function FZu(u,e,t=uw(32)){let r=an("message",u),{bytes:n,scalar:i}=VN(e),s=an("auxRand",t,32),a=HN(i^sn(Ew("BIP0340/aux",s))),l=Ew("BIP0340/nonce",a,n,r),c=Em(sn(l));if(c===mw)throw new Error("sign failed: k is zero");let{bytes:d,scalar:f}=VN(c),h=Ynu(d,n,r),g=new Uint8Array(64);if(g.set(d,0),g.set(HN(Em(f+h*i)),32),!Xnu(g,r,n))throw new Error("sign: Invalid signature produced");return g}function Xnu(u,e,t){let r=an("signature",u,64),n=an("message",e),i=an("publicKey",t,32);try{let s=Jnu(sn(i)),a=sn(r.subarray(0,32));if(!$nu(a))return!1;let l=sn(r.subarray(32,64));if(!xZu(l))return!1;let c=Ynu(HN(a),GN(s),n),d=DZu(s,l,Em(-c));return!(!d||!d.hasEvenY()||d.toAffine().x!==a)}catch{return!1}}var hw,fw,Znu,pw,Gnu,Y2,F6,mw,$nu,xZu,Knu,GN,HN,WN,Em,KN,DZu,kZu,SZu,IZu,uiu,MZu,RZu,ZN=H(()=>{kN();v6();pm();zN();Q2();qnu();Vnu();hw=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),fw=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Znu=BigInt(1),pw=BigInt(2),Gnu=(u,e)=>(u+e/pw)/e;Y2=Inu(hw,void 0,void 0,{sqrt:Qnu}),F6=Hnu({a:BigInt(0),b:BigInt(7),Fp:Y2,n:fw,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:u=>{let e=fw,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Znu*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),n=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=t,s=BigInt("0x100000000000000000000000000000000"),a=Gnu(i*u,e),l=Gnu(-r*u,e),c=Ir(u-a*t-l*n,e),d=Ir(-a*r-l*i,e),f=c>s,h=d>s;if(f&&(c=e-c),h&&(d=e-d),c>s||d>s)throw new Error("splitScalar: Endomorphism failed, k="+u);return{k1neg:f,k1:c,k2neg:h,k2:d}}}},w6),mw=BigInt(0),$nu=u=>typeof u=="bigint"&&mwtypeof u=="bigint"&&mwu.toRawBytes(!0).slice(1),HN=u=>la(u,32),WN=u=>Ir(u,hw),Em=u=>Ir(u,fw),KN=F6.ProjectivePoint,DZu=(u,e,t)=>KN.BASE.multiplyAndAddUnsafe(u,e,t);kZu={getPublicKey:_Zu,sign:FZu,verify:Xnu,utils:{randomPrivateKey:F6.utils.randomPrivateKey,lift_x:Jnu,pointToBytes:GN,numberToBytesBE:la,bytesToNumberBE:sn,taggedHash:Ew,mod:Ir}},SZu=znu(Y2,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(u=>u.map(e=>BigInt(e)))),IZu=Lnu(Y2,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:Y2.create(BigInt("-11"))}),uiu=Unu(F6.ProjectivePoint,u=>{let{x:e,y:t}=IZu(Y2.create(u[0]));return SZu(e,t)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:Y2.ORDER,m:1,k:128,expand:"xmd",hash:w6}),MZu=uiu.hashToCurve,RZu=uiu.encodeToCurve});async function riu({hash:u,signature:e}){let t=$t(u)?u:Gu(u),{secp256k1:r}=await Promise.resolve().then(()=>(ZN(),eiu));return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){let{r:c,s:d,v:f,yParity:h}=e,g=Number(h??f),v=tiu(g);return new r.Signature(Ae(c),Ae(d)).addRecoveryBit(v)}let s=$t(e)?e:Gu(e),a=ir(`0x${s.slice(130)}`),l=tiu(a);return r.Signature.fromCompact(s.substring(2,130)).addRecoveryBit(l)})().recoverPublicKey(t.substring(2)).toHex(!1)}`}function tiu(u){if(u===0||u===1)return u;if(u===27)return 0;if(u===28)return 1;throw new Error("Invalid yParityOrV value")}var niu=H(()=>{Y4();on();L0()});async function gw({hash:u,signature:e}){return vnu(await riu({hash:u,signature:e}))}var QN=H(()=>{ynu();niu()});var hm,Dp,Cw,$N=H(()=>{he();hm=class extends vu{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}},Dp=class extends vu{constructor({length:e,position:t}){super(`Position \`${t}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}},Cw=class extends vu{constructor({count:e,limit:t}){super(`Recursive read limit of \`${t}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}});function _p(u,{recursiveReadLimit:e=8192}={}){let t=Object.create(TZu);return t.bytes=u,t.dataView=new DataView(u.buffer,u.byteOffset,u.byteLength),t.positionReadCount=new Map,t.recursiveReadLimit=e,t}var TZu,Aw=H(()=>{$N();TZu={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new Cw({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(u){if(u<0||u>this.bytes.length-1)throw new Dp({length:this.bytes.length,position:u})},decrementPosition(u){if(u<0)throw new hm({offset:u});let e=this.position-u;this.assertPosition(e),this.position=e},getReadCount(u){return this.positionReadCount.get(u||this.position)||0},incrementPosition(u){if(u<0)throw new hm({offset:u});let e=this.position+u;this.assertPosition(e),this.position=e},inspectByte(u){let e=u??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(u,e){let t=e??this.position;return this.assertPosition(t+u-1),this.bytes.subarray(t,t+u)},inspectUint8(u){let e=u??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(u){let e=u??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(u){let e=u??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(u){let e=u??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(u){this.assertPosition(this.position),this.bytes[this.position]=u,this.position++},pushBytes(u){this.assertPosition(this.position+u.length-1),this.bytes.set(u,this.position),this.position+=u.length},pushUint8(u){this.assertPosition(this.position),this.bytes[this.position]=u,this.position++},pushUint16(u){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,u),this.position+=2},pushUint24(u){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,u>>8),this.dataView.setUint8(this.position+2,u&255),this.position+=3},pushUint32(u){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,u),this.position+=4},readByte(){this.assertReadLimit(),this._touch();let u=this.inspectByte();return this.position++,u},readBytes(u,e){this.assertReadLimit(),this._touch();let t=this.inspectBytes(u);return this.position+=e??u,t},readUint8(){this.assertReadLimit(),this._touch();let u=this.inspectUint8();return this.position+=1,u},readUint16(){this.assertReadLimit(),this._touch();let u=this.inspectUint16();return this.position+=2,u},readUint24(){this.assertReadLimit(),this._touch();let u=this.inspectUint24();return this.position+=3,u},readUint32(){this.assertReadLimit(),this._touch();let u=this.inspectUint32();return this.position+=4,u},get remaining(){return this.bytes.length-this.position},setPosition(u){let e=this.position;return this.assertPosition(u),this.position=u,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;let u=this.getReadCount();this.positionReadCount.set(this.position,u+1),u>0&&this.recursiveReadCount++}}});function Xi(u,e="hex"){let t=iiu(u),r=_p(new Uint8Array(t.length));return t.encode(r),e==="hex"?He(r.bytes):r.bytes}function iiu(u){return Array.isArray(u)?OZu(u.map(e=>iiu(e))):PZu(u)}function OZu(u){let e=u.reduce((n,i)=>n+i.length,0),t=oiu(e);return{length:e<=55?1+e:1+t+e,encode(n){e<=55?n.pushByte(192+e):(n.pushByte(247+t),t===1?n.pushUint8(e):t===2?n.pushUint16(e):t===3?n.pushUint24(e):n.pushUint32(e));for(let{encode:i}of u)i(n)}}}function PZu(u){let e=typeof u=="string"?Ut(u):u,t=oiu(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+t+e.length,encode(n){e.length===1&&e[0]<128?n.pushBytes(e):e.length<=55?(n.pushByte(128+e.length),n.pushBytes(e)):(n.pushByte(183+t),t===1?n.pushUint8(e.length):t===2?n.pushUint16(e.length):t===3?n.pushUint24(e.length):n.pushUint32(e.length),n.pushBytes(e))}}}function oiu(u){if(u<2**8)return 1;if(u<2**16)return 2;if(u<2**24)return 3;if(u<2**32)return 4;throw new vu("Length is too large.")}var Fp=H(()=>{he();Aw();Cr();L0()});function siu(u){let{chainId:e,contractAddress:t,nonce:r,to:n}=u,i=pt(Wr(["0x05",Xi([Zu(e),t,Zu(r)])]));return n==="bytes"?Ut(i):i}var aiu=H(()=>{So();Cr();L0();Fp();us()});async function vw(u){let{authorization:e,signature:t}=u;return gw({hash:siu(e),signature:t??e})}var JN=H(()=>{QN();aiu()});var k6,yw,bw,mm,da,S6=H(()=>{he();k6=class extends vu{constructor({blockNumber:e,chain:t,contract:r}){super(`Chain "${t.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...e&&r.blockCreated&&r.blockCreated>e?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}},yw=class extends vu{constructor({chain:e,currentChainId:t}){super(`The current chain of the wallet (id: ${t}) does not match the target chain for the transaction (id: ${e.id} \u2013 ${e.name}).`,{metaMessages:[`Current Chain ID: ${t}`,`Expected Chain ID: ${e.id} \u2013 ${e.name}`],name:"ChainMismatchError"})}},bw=class extends vu{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(`
`),{name:"ChainNotFoundError"})}},mm=class extends vu{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}},da=class extends vu{constructor({chainId:e}){super(typeof e=="number"?`Chain ID "${e}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}});function ww({chain:u,currentChainId:e}){if(!u)throw new bw;if(e!==u.id)throw new yw({chain:u,currentChainId:e})}var YN=H(()=>{S6()});var XN,uL,eL,Bw=H(()=>{XN={gwei:9,wei:18},uL={ether:-9,wei:9},eL={ether:-18,gwei:-9}});function X2(u,e){let t=u.toString(),r=t.startsWith("-");r&&(t=t.slice(1)),t=t.padStart(e,"0");let[n,i]=[t.slice(0,t.length-e),t.slice(t.length-e)];return i=i.replace(/(0+)$/,""),`${r?"-":""}${n||"0"}${i?`.${i}`:""}`}var xw=H(()=>{});function cn(u,e="wei"){return X2(u,uL[e])}var kp=H(()=>{Bw();xw()});var ec,Mo,Sp,Ip,Mp,Rp,Tp,Op,Pp,Np,rs,o3,u1=H(()=>{kp();he();ec=class extends vu{constructor({cause:e,message:t}={}){let r=t?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}};Object.defineProperty(ec,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(ec,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});Mo=class extends vu{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${cn(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}};Object.defineProperty(Mo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});Sp=class extends vu{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${cn(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}};Object.defineProperty(Sp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});Ip=class extends vu{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}};Object.defineProperty(Ip,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});Mp=class extends vu{constructor({cause:e,nonce:t}={}){super([`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
`),{cause:e,name:"NonceTooLowError"})}};Object.defineProperty(Mp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});Rp=class extends vu{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}};Object.defineProperty(Rp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});Tp=class extends vu{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
`),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}};Object.defineProperty(Tp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds/});Op=class extends vu{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}};Object.defineProperty(Op,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});Pp=class extends vu{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}};Object.defineProperty(Pp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});Np=class extends vu{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}};Object.defineProperty(Np,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});rs=class extends vu{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${cn(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${cn(r)} gwei`:""}).`].join(`
`),{cause:e,name:"TipAboveFeeCapError"})}};Object.defineProperty(rs,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});o3=class extends vu{constructor({cause:e}){super(`An error occurred while executing: ${e?.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}});function Lp(u,e="wei"){return X2(u,XN[e])}var Dw=H(()=>{Bw();xw()});function I6(u){let e=Object.entries(u).map(([r,n])=>n===void 0||n===!1?null:[r,n]).filter(Boolean),t=e.reduce((r,[n])=>Math.max(r,n.length),0);return e.map(([r,n])=>` ${`${r}:`.padEnd(t+1)} ${n}`).join(`
`)}var _w,Fw,kw,Sw,Iw,jp,zp,gm,fa=H(()=>{Dw();kp();he();_w=class extends vu{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
`),{name:"FeeConflictError"})}},Fw=class extends vu{constructor({v:e}){super(`Invalid \`v\` value "${e}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}},kw=class extends vu{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",I6(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}},Sw=class extends vu{constructor({storageKey:e}){super(`Size for storage key "${e}" is invalid. Expected 32 bytes. Got ${Math.floor((e.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}},Iw=class extends vu{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:s,gasPrice:a,maxFeePerGas:l,maxPriorityFeePerGas:c,nonce:d,to:f,value:h}){let g=I6({chain:n&&`${n?.name} (id: ${n?.id})`,from:t?.address,to:f,value:typeof h<"u"&&`${Lp(h)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:s,gasPrice:typeof a<"u"&&`${cn(a)} gwei`,maxFeePerGas:typeof l<"u"&&`${cn(l)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${cn(c)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",g].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}},jp=class extends vu{constructor({blockHash:e,blockNumber:t,blockTag:r,hash:n,index:i}){let s="Transaction";r&&i!==void 0&&(s=`Transaction at block time "${r}" at index "${i}"`),e&&i!==void 0&&(s=`Transaction at block hash "${e}" at index "${i}"`),t&&i!==void 0&&(s=`Transaction at block number "${t}" at index "${i}"`),n&&(s=`Transaction with hash "${n}"`),super(`${s} could not be found.`,{name:"TransactionNotFoundError"})}},zp=class extends vu{constructor({hash:e}){super(`Transaction receipt with hash "${e}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}},gm=class extends vu{constructor({hash:e}){super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}});var Xe,Ro=H(()=>{Xe=(u,e,t)=>JSON.stringify(u,(r,n)=>{let i=typeof n=="bigint"?n.toString():n;return typeof e=="function"?e(r,i):i},t)});var liu,M6,Mw=H(()=>{liu=u=>u,M6=u=>u});var ns,Up,Cm,qp=H(()=>{Ro();he();Mw();ns=class extends vu{constructor({body:e,cause:t,details:r,headers:n,status:i,url:s}){super("HTTP request failed.",{cause:t,details:r,metaMessages:[i&&`Status: ${i}`,`URL: ${M6(s)}`,e&&`Request body: ${Xe(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=n,this.status=i,this.url=s}},Up=class extends vu{constructor({body:e,error:t,url:r}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${M6(r)}`,`Request body: ${Xe(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code}},Cm=class extends vu{constructor({body:e,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${M6(t)}`,`Request body: ${Xe(e)}`],name:"TimeoutError"})}}});var NZu,Kn,tc,R6,T6,O6,P6,s3,pa,N6,Ea,L6,j6,e1,z6,nt,U6,q6,W6,H6,Zn,Am,Wp=H(()=>{he();qp();NZu=-1,Kn=class extends vu{constructor(e,{code:t,docsPath:r,metaMessages:n,name:i,shortMessage:s}){super(s,{cause:e,docsPath:r,metaMessages:n||e?.metaMessages,name:i||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=i||e.name,this.code=e instanceof Up?e.code:t??NZu}},tc=class extends Kn{constructor(e,t){super(e,t),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}},R6=class u extends Kn{constructor(e){super(e,{code:u.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}};Object.defineProperty(R6,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});T6=class u extends Kn{constructor(e){super(e,{code:u.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}};Object.defineProperty(T6,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});O6=class u extends Kn{constructor(e,{method:t}={}){super(e,{code:u.code,name:"MethodNotFoundRpcError",shortMessage:`The method${t?` "${t}"`:""} does not exist / is not available.`})}};Object.defineProperty(O6,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});P6=class u extends Kn{constructor(e){super(e,{code:u.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
`)})}};Object.defineProperty(P6,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});s3=class u extends Kn{constructor(e){super(e,{code:u.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}};Object.defineProperty(s3,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});pa=class u extends Kn{constructor(e){super(e,{code:u.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
`)})}};Object.defineProperty(pa,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});N6=class u extends Kn{constructor(e){super(e,{code:u.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}};Object.defineProperty(N6,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});Ea=class u extends Kn{constructor(e){super(e,{code:u.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}};Object.defineProperty(Ea,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});L6=class u extends Kn{constructor(e){super(e,{code:u.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}};Object.defineProperty(L6,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});j6=class u extends Kn{constructor(e,{method:t}={}){super(e,{code:u.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${t?` "${t}"`:""} is not implemented.`})}};Object.defineProperty(j6,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});e1=class u extends Kn{constructor(e){super(e,{code:u.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}};Object.defineProperty(e1,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});z6=class u extends Kn{constructor(e){super(e,{code:u.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}};Object.defineProperty(z6,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});nt=class u extends tc{constructor(e){super(e,{code:u.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}};Object.defineProperty(nt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});U6=class u extends tc{constructor(e){super(e,{code:u.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}};Object.defineProperty(U6,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});q6=class u extends tc{constructor(e,{method:t}={}){super(e,{code:u.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${t?` " ${t}"`:""}.`})}};Object.defineProperty(q6,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});W6=class u extends tc{constructor(e){super(e,{code:u.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}};Object.defineProperty(W6,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});H6=class u extends tc{constructor(e){super(e,{code:u.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}};Object.defineProperty(H6,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});Zn=class u extends tc{constructor(e){super(e,{code:u.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}};Object.defineProperty(Zn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});Am=class extends Kn{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}});function Hp(u,e){let t=(u.details||"").toLowerCase(),r=u instanceof vu?u.walk(n=>n.code===ec.code):u;return r instanceof vu?new ec({cause:u,message:r.details}):ec.nodeMessage.test(t)?new ec({cause:u,message:u.details}):Mo.nodeMessage.test(t)?new Mo({cause:u,maxFeePerGas:e?.maxFeePerGas}):Sp.nodeMessage.test(t)?new Sp({cause:u,maxFeePerGas:e?.maxFeePerGas}):Ip.nodeMessage.test(t)?new Ip({cause:u,nonce:e?.nonce}):Mp.nodeMessage.test(t)?new Mp({cause:u,nonce:e?.nonce}):Rp.nodeMessage.test(t)?new Rp({cause:u,nonce:e?.nonce}):Tp.nodeMessage.test(t)?new Tp({cause:u}):Op.nodeMessage.test(t)?new Op({cause:u,gas:e?.gas}):Pp.nodeMessage.test(t)?new Pp({cause:u,gas:e?.gas}):Np.nodeMessage.test(t)?new Np({cause:u}):rs.nodeMessage.test(t)?new rs({cause:u,maxFeePerGas:e?.maxFeePerGas,maxPriorityFeePerGas:e?.maxPriorityFeePerGas}):new o3({cause:u})}var Rw=H(()=>{he();u1()});function ciu(u,{docsPath:e,...t}){let r=(()=>{let n=Hp(u,t);return n instanceof o3?u:n})();return new Iw(r,{docsPath:e,...t})}var diu=H(()=>{u1();fa();Rw()});function Vp(u,{format:e}){if(!e)return{};let t={};function r(i){let s=Object.keys(i);for(let a of s)a in u&&(t[a]=u[a]),i[a]&&typeof i[a]=="object"&&!Array.isArray(i[a])&&r(i[a])}let n=e(u||{});return r(n),t}var Tw=H(()=>{});function t1(u,e){return({exclude:t,format:r})=>({exclude:t,format:n=>{let i=e(n);if(t)for(let s of t)delete i[s];return{...i,...r(n)}},type:u})}var vm=H(()=>{});function rc(u){let e={};return typeof u.authorizationList<"u"&&(e.authorizationList=jZu(u.authorizationList)),typeof u.accessList<"u"&&(e.accessList=u.accessList),typeof u.blobVersionedHashes<"u"&&(e.blobVersionedHashes=u.blobVersionedHashes),typeof u.blobs<"u"&&(typeof u.blobs[0]!="string"?e.blobs=u.blobs.map(t=>He(t)):e.blobs=u.blobs),typeof u.data<"u"&&(e.data=u.data),typeof u.from<"u"&&(e.from=u.from),typeof u.gas<"u"&&(e.gas=Zu(u.gas)),typeof u.gasPrice<"u"&&(e.gasPrice=Zu(u.gasPrice)),typeof u.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=Zu(u.maxFeePerBlobGas)),typeof u.maxFeePerGas<"u"&&(e.maxFeePerGas=Zu(u.maxFeePerGas)),typeof u.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=Zu(u.maxPriorityFeePerGas)),typeof u.nonce<"u"&&(e.nonce=Zu(u.nonce)),typeof u.to<"u"&&(e.to=u.to),typeof u.type<"u"&&(e.type=LZu[u.type]),typeof u.value<"u"&&(e.value=Zu(u.value)),e}function jZu(u){return u.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:Zu(e.chainId),nonce:Zu(e.nonce),...typeof e.yParity<"u"?{yParity:Zu(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Zu(e.v)}:{}}))}var LZu,Ow,V6=H(()=>{L0();vm();LZu={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};Ow=t1("transactionRequest",rc)});function s0(u,e,t){let r=u[e.name];if(typeof r=="function")return r;let n=u[t];return typeof n=="function"?n:i=>e(u,i)}var Mt=H(()=>{});function a3(u){let{account:e,gasPrice:t,maxFeePerGas:r,maxPriorityFeePerGas:n,to:i}=u,s=e?Et(e):void 0;if(s&&!ve(s.address))throw new Ye({address:s.address});if(i&&!ve(i))throw new Ye({address:i});if(typeof t<"u"&&(typeof r<"u"||typeof n<"u"))throw new _w;if(r&&r>2n**256n-1n)throw new Mo({maxFeePerGas:r});if(n&&r&&n>r)throw new rs({maxFeePerGas:r,maxPriorityFeePerGas:n})}var Gp=H(()=>{Yi();X4();u1();fa();Io()});async function l3(u){let e=await u.request({method:"eth_chainId"},{dedupe:!0});return ir(e)}var Kp=H(()=>{on()});var Pw,r1,Nw,Lw=H(()=>{kp();he();Pw=class extends vu{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}},r1=class extends vu{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}},Nw=class extends vu{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${cn(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}});var Zp,tL=H(()=>{he();Zp=class extends vu{constructor({blockHash:e,blockNumber:t}){let r="Block";e&&(r=`Block at hash "${e}"`),t&&(r=`Block at number "${t}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}});function nc(u){let e={...u,blockHash:u.blockHash?u.blockHash:null,blockNumber:u.blockNumber?BigInt(u.blockNumber):null,chainId:u.chainId?ir(u.chainId):void 0,gas:u.gas?BigInt(u.gas):void 0,gasPrice:u.gasPrice?BigInt(u.gasPrice):void 0,maxFeePerBlobGas:u.maxFeePerBlobGas?BigInt(u.maxFeePerBlobGas):void 0,maxFeePerGas:u.maxFeePerGas?BigInt(u.maxFeePerGas):void 0,maxPriorityFeePerGas:u.maxPriorityFeePerGas?BigInt(u.maxPriorityFeePerGas):void 0,nonce:u.nonce?ir(u.nonce):void 0,to:u.to?u.to:null,transactionIndex:u.transactionIndex?Number(u.transactionIndex):null,type:u.type?rL[u.type]:void 0,typeHex:u.type?u.type:void 0,value:u.value?BigInt(u.value):void 0,v:u.v?BigInt(u.v):void 0};return u.authorizationList&&(e.authorizationList=zZu(u.authorizationList)),e.yParity=(()=>{if(u.yParity)return Number(u.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function zZu(u){return u.map(e=>({contractAddress:e.address,r:e.r,s:e.s,chainId:Number(e.chainId),nonce:Number(e.nonce),...typeof e.yParity<"u"?{yParity:Number(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Number(e.v)}:{}}))}var rL,Qp,G6=H(()=>{on();vm();rL={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};Qp=t1("transaction",nc)});function ym(u){let e=u.transactions?.map(t=>typeof t=="string"?t:nc(t));return{...u,baseFeePerGas:u.baseFeePerGas?BigInt(u.baseFeePerGas):null,blobGasUsed:u.blobGasUsed?BigInt(u.blobGasUsed):void 0,difficulty:u.difficulty?BigInt(u.difficulty):void 0,excessBlobGas:u.excessBlobGas?BigInt(u.excessBlobGas):void 0,gasLimit:u.gasLimit?BigInt(u.gasLimit):void 0,gasUsed:u.gasUsed?BigInt(u.gasUsed):void 0,hash:u.hash?u.hash:null,logsBloom:u.logsBloom?u.logsBloom:null,nonce:u.nonce?u.nonce:null,number:u.number?BigInt(u.number):null,size:u.size?BigInt(u.size):void 0,timestamp:u.timestamp?BigInt(u.timestamp):void 0,transactions:e,totalDifficulty:u.totalDifficulty?BigInt(u.totalDifficulty):null}}var $p,Jp=H(()=>{vm();G6();$p=t1("block",ym)});async function To(u,{blockHash:e,blockNumber:t,blockTag:r,includeTransactions:n}={}){let i=r??"latest",s=n??!1,a=t!==void 0?Zu(t):void 0,l=null;if(e?l=await u.request({method:"eth_getBlockByHash",params:[e,s]},{dedupe:!0}):l=await u.request({method:"eth_getBlockByNumber",params:[a||i,s]},{dedupe:!!a}),!l)throw new Zp({blockHash:e,blockNumber:t});return(u.chain?.formatters?.block?.format||ym)(l)}var K6=H(()=>{tL();L0();Jp()});async function Yp(u){let e=await u.request({method:"eth_gasPrice"});return BigInt(e)}var jw=H(()=>{});async function fiu(u,e){return nL(u,e)}async function nL(u,e){let{block:t,chain:r=u.chain,request:n}=e||{};if(typeof r?.fees?.defaultPriorityFee=="function"){let i=t||await s0(u,To,"getBlock")({});return r.fees.defaultPriorityFee({block:i,client:u,request:n})}if(typeof r?.fees?.defaultPriorityFee<"u")return r?.fees?.defaultPriorityFee;try{let i=await u.request({method:"eth_maxPriorityFeePerGas"});return Ae(i)}catch{let[i,s]=await Promise.all([t?Promise.resolve(t):s0(u,To,"getBlock")({}),s0(u,Yp,"getGasPrice")({})]);if(typeof i.baseFeePerGas!="bigint")throw new r1;let a=s-i.baseFeePerGas;return a<0n?0n:a}}var iL=H(()=>{Lw();on();Mt();K6();jw()});async function piu(u,e){return zw(u,e)}async function zw(u,e){let{block:t,chain:r=u.chain,request:n,type:i="eip1559"}=e||{},s=await(async()=>typeof r?.fees?.baseFeeMultiplier=="function"?r.fees.baseFeeMultiplier({block:t,client:u,request:n}):r?.fees?.baseFeeMultiplier??1.2)();if(s<1)throw new Pw;let l=10**(s.toString().split(".")[1]?.length??0),c=h=>h*BigInt(Math.ceil(s*l))/BigInt(l),d=t||await s0(u,To,"getBlock")({});if(typeof r?.fees?.estimateFeesPerGas=="function"){let h=await r.fees.estimateFeesPerGas({block:t,client:u,multiply:c,request:n,type:i});if(h!==null)return h}if(i==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new r1;let h=typeof n?.maxPriorityFeePerGas=="bigint"?n.maxPriorityFeePerGas:await nL(u,{block:d,chain:r,request:n}),g=c(d.baseFeePerGas);return{maxFeePerGas:n?.maxFeePerGas??g+h,maxPriorityFeePerGas:h}}return{gasPrice:n?.gasPrice??c(await s0(u,Yp,"getGasPrice")({}))}}var oL=H(()=>{Lw();Mt();iL();K6();jw()});var Uw,Eiu=H(()=>{Dw();kp();he();fa();Uw=class extends vu{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:s,gasPrice:a,maxFeePerGas:l,maxPriorityFeePerGas:c,nonce:d,to:f,value:h}){let g=I6({from:t?.address,to:f,value:typeof h<"u"&&`${Lp(h)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:s,gasPrice:typeof a<"u"&&`${cn(a)} gwei`,maxFeePerGas:typeof l<"u"&&`${cn(l)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${cn(c)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",g].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}});function hiu(u,{docsPath:e,...t}){let r=(()=>{let n=Hp(u,t);return n instanceof o3?u:n})();return new Uw(r,{docsPath:e,...t})}var miu=H(()=>{Eiu();u1();Rw()});function giu(u){return u.reduce((e,{slot:t,value:r})=>`${e} ${t}: ${r}
`,"")}function Ciu(u){return u.reduce((e,{address:t,...r})=>{let n=`${e} ${t}:
`;return r.nonce&&(n+=` nonce: ${r.nonce}
`),r.balance&&(n+=` balance: ${r.balance}
`),r.code&&(n+=` code: ${r.code}
`),r.state&&(n+=` state:
`,n+=giu(r.state)),r.stateDiff&&(n+=` stateDiff:
`,n+=giu(r.stateDiff)),n},` State Override:
`).slice(0,-1)}var qw,Ww,sL=H(()=>{he();qw=class extends vu{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}},Ww=class extends vu{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}});function Aiu(u){if(!(!u||u.length===0))return u.reduce((e,{slot:t,value:r})=>{if(t.length!==66)throw new tm({size:t.length,targetSize:66,type:"hex"});if(r.length!==66)throw new tm({size:r.length,targetSize:66,type:"hex"});return e[t]=r,e},{})}function UZu(u){let{balance:e,nonce:t,state:r,stateDiff:n,code:i}=u,s={};if(i!==void 0&&(s.code=i),e!==void 0&&(s.balance=Zu(e)),t!==void 0&&(s.nonce=Zu(t)),r!==void 0&&(s.state=Aiu(r)),n!==void 0){if(s.state)throw new Ww;s.stateDiff=Aiu(n)}return s}function Hw(u){if(!u)return;let e={};for(let{address:t,...r}of u){if(!ve(t,{strict:!1}))throw new Ye({address:t});if(e[t])throw new qw({address:t});e[t]=UZu(r)}return e}var aL=H(()=>{X4();Rb();sL();Io();L0()});async function Z6(u,{address:e,blockNumber:t,blockTag:r="latest"}){let n=t?Zu(t):void 0,i=await u.request({method:"eth_getBalance",params:[e,n||r]});return BigInt(i)}var Vw=H(()=>{L0()});async function Xp(u,e){let t=e.account??u.account,r=t?Et(t):void 0;try{let q=function(E){let{block:m,request:y,rpcStateOverride:_}=E;return u.request({method:"eth_estimateGas",params:_?[y,m??"latest",_]:m?[y,m]:[y]})},{accessList:n,authorizationList:i,blobs:s,blobVersionedHashes:a,blockNumber:l,blockTag:c,data:d,gas:f,gasPrice:h,maxFeePerBlobGas:g,maxFeePerGas:v,maxPriorityFeePerGas:D,nonce:F,value:w,stateOverride:x,...M}=await n1(u,{...e,parameters:r?.type==="local"?void 0:["blobVersionedHashes"]}),L=(l?Zu(l):void 0)||c,j=Hw(x),P=await(async()=>{if(M.to)return M.to;if(i&&i.length>0)return await vw({authorization:i[0]}).catch(()=>{throw new vu("`to` is required. Could not infer from `authorizationList`")})})();a3(e);let z=u.chain?.formatters?.transactionRequest?.format,V=(z||rc)({...Vp(M,{format:z}),from:r?.address,accessList:n,authorizationList:i,blobs:s,blobVersionedHashes:a,data:d,gas:f,gasPrice:h,maxFeePerBlobGas:g,maxFeePerGas:v,maxPriorityFeePerGas:D,nonce:F,to:P,value:w}),Z=BigInt(await q({block:L,request:V,rpcStateOverride:j}));if(i){let E=await Z6(u,{address:V.from}),m=await Promise.all(i.map(async y=>{let{contractAddress:_}=y,k=await q({block:L,request:{authorizationList:void 0,data:d,from:r?.address,to:_,value:Zu(E)},rpcStateOverride:j}).catch(()=>100000n);return 2n*BigInt(k)}));Z+=m.reduce((y,_)=>y+_,0n)}return Z}catch(n){throw hiu(n,{...e,account:r,chain:u.chain})}}var Gw=H(()=>{Yi();he();JN();L0();miu();Tw();V6();aL();Gp();bm();Vw()});async function Kw(u,{address:e,blockTag:t="latest",blockNumber:r}){let n=await u.request({method:"eth_getTransactionCount",params:[e,r?Zu(r):t]},{dedupe:!!r});return ir(n)}var lL=H(()=>{on();L0()});function uE(u){let{kzg:e}=u,t=u.to??(typeof u.blobs[0]=="string"?"hex":"bytes"),r=typeof u.blobs[0]=="string"?u.blobs.map(i=>Ut(i)):u.blobs,n=[];for(let i of r)n.push(Uint8Array.from(e.blobToKzgCommitment(i)));return t==="bytes"?n:n.map(i=>He(i))}var Zw=H(()=>{Cr();L0()});function eE(u){let{kzg:e}=u,t=u.to??(typeof u.blobs[0]=="string"?"hex":"bytes"),r=typeof u.blobs[0]=="string"?u.blobs.map(s=>Ut(s)):u.blobs,n=typeof u.commitments[0]=="string"?u.commitments.map(s=>Ut(s)):u.commitments,i=[];for(let s=0;sHe(s))}var Qw=H(()=>{Cr();L0()});function $w(u,e){let t=e||"hex",r=w6($t(u,{strict:!1})?nn(u):u);return t==="bytes"?r:Gu(r)}var cL=H(()=>{kN();Y4();Cr();L0()});function viu(u){let{commitment:e,version:t=1}=u,r=u.to??(typeof e=="string"?"hex":"bytes"),n=$w(e,"bytes");return n.set([t],0),r==="bytes"?n:He(n)}var yiu=H(()=>{L0();cL()});function Jw(u){let{commitments:e,version:t}=u,r=u.to??(typeof e[0]=="string"?"hex":"bytes"),n=[];for(let i of e)n.push(viu({commitment:i,to:r,version:t}));return n}var dL=H(()=>{yiu()});var Yw,tE,Xw,uB,fL=H(()=>{he();Yw=class extends vu{constructor({maxSize:e,size:t}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${t} bytes`],name:"BlobSizeTooLargeError"})}},tE=class extends vu{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}},Xw=class extends vu{constructor({hash:e,size:t}){super(`Versioned hash "${e}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${t}`],name:"InvalidVersionedHashSizeError"})}},uB=class extends vu{constructor({hash:e,version:t}){super(`Versioned hash "${e}" version is invalid.`,{metaMessages:[`Expected: ${1}`,`Received: ${t}`],name:"InvalidVersionedHashVersionError"})}}});function biu(u){let e=u.to??(typeof u.data=="string"?"hex":"bytes"),t=typeof u.data=="string"?Ut(u.data):u.data,r=Je(t);if(!r)throw new tE;if(r>761855)throw new Yw({maxSize:761855,size:r});let n=[],i=!0,s=0;for(;i;){let a=_p(new Uint8Array(131072)),l=0;for(;l<4096;){let c=t.slice(s,s+31);if(a.pushByte(0),a.pushBytes(c),c.length<31){a.pushByte(128),i=!1;break}l++,s+=31}n.push(a)}return e==="bytes"?n.map(a=>a.bytes):n.map(a=>He(a.bytes))}var wiu=H(()=>{fL();Aw();na();Cr();L0()});function eB(u){let{data:e,kzg:t,to:r}=u,n=u.blobs??biu({data:e,to:r}),i=u.commitments??uE({blobs:n,kzg:t,to:r}),s=u.proofs??eE({blobs:n,commitments:i,kzg:t,to:r}),a=[];for(let l=0;l{Zw();Qw();wiu()});function tB(u){if(u.type)return u.type;if(typeof u.authorizationList<"u")return"eip7702";if(typeof u.blobs<"u"||typeof u.blobVersionedHashes<"u"||typeof u.maxFeePerBlobGas<"u"||typeof u.sidecars<"u")return"eip4844";if(typeof u.maxFeePerGas<"u"||typeof u.maxPriorityFeePerGas<"u")return"eip1559";if(typeof u.gasPrice<"u")return typeof u.accessList<"u"?"eip2930":"legacy";throw new kw({transaction:u})}var EL=H(()=>{fa()});async function n1(u,e){let{account:t=u.account,blobs:r,chain:n,gas:i,kzg:s,nonce:a,parameters:l=hL,type:c}=e,d=t?Et(t):void 0,f={...e,...d?{from:d?.address}:{}},h;async function g(){return h||(h=await s0(u,To,"getBlock")({blockTag:"latest"}),h)}let v;async function D(){return v||(n?n.id:typeof e.chainId<"u"?e.chainId:(v=await s0(u,l3,"getChainId")({}),v))}if((l.includes("blobVersionedHashes")||l.includes("sidecars"))&&r&&s){let F=uE({blobs:r,kzg:s});if(l.includes("blobVersionedHashes")){let w=Jw({commitments:F,to:"hex"});f.blobVersionedHashes=w}if(l.includes("sidecars")){let w=eE({blobs:r,commitments:F,kzg:s}),x=eB({blobs:r,commitments:F,proofs:w,to:"hex"});f.sidecars=x}}if(l.includes("chainId")&&(f.chainId=await D()),l.includes("nonce")&&typeof a>"u"&&d)if(d.nonceManager){let F=await D();f.nonce=await d.nonceManager.consume({address:d.address,chainId:F,client:u})}else f.nonce=await s0(u,Kw,"getTransactionCount")({address:d.address,blockTag:"pending"});if((l.includes("fees")||l.includes("type"))&&typeof c>"u")try{f.type=tB(f)}catch{let F=await g();f.type=typeof F?.baseFeePerGas=="bigint"?"eip1559":"legacy"}if(l.includes("fees"))if(f.type!=="legacy"&&f.type!=="eip2930"){if(typeof f.maxFeePerGas>"u"||typeof f.maxPriorityFeePerGas>"u"){let F=await g(),{maxFeePerGas:w,maxPriorityFeePerGas:x}=await zw(u,{block:F,chain:n,request:f});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(f.gas=await s0(u,Xp,"estimateGas")({...f,account:d?{address:d.address,type:"json-rpc"}:void 0})),a3(f),delete f.parameters,f}var hL,bm=H(()=>{Yi();oL();Gw();K6();lL();Lw();Zw();Qw();dL();pL();Mt();Gp();EL();Kp();hL=["blobVersionedHashes","chainId","fees","gas","nonce","type"]});async function rE(u,{serializedTransaction:e}){return u.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}var rB=H(()=>{});async function nE(u,e){let{account:t=u.account,chain:r=u.chain,accessList:n,authorizationList:i,blobs:s,data:a,gas:l,gasPrice:c,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:h,nonce:g,value:v,...D}=e;if(!t)throw new es({docsPath:"/docs/actions/wallet/sendTransaction"});let F=Et(t);try{a3(e);let w=await(async()=>{if(e.to)return e.to;if(i&&i.length>0)return await vw({authorization:i[0]}).catch(()=>{throw new vu("`to` is required. Could not infer from `authorizationList`.")})})();if(F.type==="json-rpc"){let x;r!==null&&(x=await s0(u,l3,"getChainId")({}),ww({currentChainId:x,chain:r}));let M=u.chain?.formatters?.transactionRequest?.format,L=(M||rc)({...Vp(D,{format:M}),accessList:n,authorizationList:i,blobs:s,chainId:x,data:a,from:F.address,gas:l,gasPrice:c,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:h,nonce:g,to:w,value:v});return await u.request({method:"eth_sendTransaction",params:[L]},{retryCount:0})}if(F.type==="local"){let x=await s0(u,n1,"prepareTransactionRequest")({account:F,accessList:n,authorizationList:i,blobs:s,chain:r,data:a,gas:l,gasPrice:c,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:h,nonce:g,parameters:[...hL,"sidecars"],value:v,...D,to:w}),M=r?.serializers?.transaction,T=await F.signTransaction(x,{serializer:M});return await s0(u,rE,"sendRawTransaction")({serializedTransaction:T})}throw F.type==="smart"?new Bp({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Bp({docsPath:"/docs/actions/wallet/sendTransaction",type:F.type})}catch(w){throw w instanceof Bp?w:ciu(w,{...e,account:F,chain:e.chain||void 0})}}var nB=H(()=>{Yi();xp();he();JN();YN();diu();Tw();V6();Mt();Gp();Kp();bm();rB()});function Biu(u,e){let{abi:t,args:r,bytecode:n,...i}=e,s=b6({abi:t,args:r,bytecode:n});return nE(u,{...i,data:s})}var xiu=H(()=>{rw();nB()});var wm,Diu,iB,_iu,mL,gL,Fiu,Q6=H(()=>{wm=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],Diu=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],iB=[...Diu,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],_iu=[...Diu,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],mL=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],gL=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],Fiu=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}]});function kiu(u,e={}){typeof e.size<"u"&&ko(u,{size:e.size});let t=He(u,e);return Ae(t,e)}function Siu(u,e={}){let t=u;if(typeof e.size<"u"&&(ko(t,{size:e.size}),t=qr(t)),t.length>1||t[0]>1)throw new Sb(t);return!!t[0]}function c3(u,e={}){typeof e.size<"u"&&ko(u,{size:e.size});let t=He(u,e);return ir(t,e)}function Iiu(u,e={}){let t=u;return typeof e.size<"u"&&(ko(t,{size:e.size}),t=qr(t,{dir:"right"})),new TextDecoder().decode(t)}var Miu=H(()=>{Mb();L2();on();L0()});function $6(u,e){let t=typeof e=="string"?Ut(e):e,r=_p(t);if(Je(t)===0&&u.length>0)throw new t3;if(Je(e)&&Je(e)<32)throw new yp({data:typeof e=="string"?e:He(e),params:u,size:Je(e)});let n=0,i=[];for(let s=0;s48?kiu(n,{signed:t}):c3(n,{signed:t}),32]}function QZu(u,e,{staticPosition:t}){let r=e.components.length===0||e.components.some(({name:s})=>!s),n=r?[]:{},i=0;if(Bm(e)){let s=c3(u.readBytes(CL)),a=t+s;for(let l=0;l{Dn();Yl();Aw();na();y6();L2();Miu();Cr();L0();V2();Riu=32,CL=32});function Tiu(u){return JZu(u)}var JZu,Oiu=H(()=>{Cr();us();JZu=u=>pt(nn(u))});var Piu,Niu=H(()=>{Piu="1.0.5"});var dn,oE=H(()=>{Niu();dn=class u extends Error{constructor(e,t={}){let r=t.cause instanceof u?t.cause.details:t.cause?.message?t.cause.message:t.details,n=t.cause instanceof u&&t.cause.docsPath||t.docsPath,i=[e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...n?[`Docs: https://abitype.dev${n}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${Piu}`].join(`
`);super(i),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),t.cause&&(this.cause=t.cause),this.details=r,this.docsPath=n,this.metaMessages=t.metaMessages,this.shortMessage=e}}});function is(u,e){return u.exec(e)?.groups}var AL,vL,sB,xm=H(()=>{AL=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,vL=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,sB=/^\(.+?\).*?$/});function aB(u){let e=u.type;if(Liu.test(u.type)&&"components"in u){e="(";let t=u.components.length;for(let n=0;n{xm();Liu=/^tuple(?(\[(\d*)\])*)$/});function sE(u){let e="",t=u.length;for(let r=0;r{jiu()});function yL(u){return u.type==="function"?`function ${u.name}(${sE(u.inputs)})${u.stateMutability&&u.stateMutability!=="nonpayable"?` ${u.stateMutability}`:""}${u.outputs.length?` returns (${sE(u.outputs)})`:""}`:u.type==="event"?`event ${u.name}(${sE(u.inputs)})`:u.type==="error"?`error ${u.name}(${sE(u.inputs)})`:u.type==="constructor"?`constructor(${sE(u.inputs)})${u.stateMutability==="payable"?" payable":""}`:u.type==="fallback"?"fallback()":"receive() external payable"}var Uiu=H(()=>{ziu()});function Wiu(u){return qiu.test(u)}function Hiu(u){return is(qiu,u)}function Giu(u){return Viu.test(u)}function Kiu(u){return is(Viu,u)}function Qiu(u){return Ziu.test(u)}function $iu(u){return is(Ziu,u)}function lB(u){return Jiu.test(u)}function Yiu(u){return is(Jiu,u)}function uou(u){return Xiu.test(u)}function eou(u){return is(Xiu,u)}function tou(u){return YZu.test(u)}function rou(u){return XZu.test(u)}var qiu,Viu,Ziu,Jiu,Xiu,YZu,XZu,nou,cB,dB=H(()=>{xm();qiu=/^error (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;Viu=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;Ziu=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/;Jiu=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;Xiu=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/;YZu=/^fallback\(\) external(?:\s(?payable{1}))?$/;XZu=/^receive\(\) external payable$/;nou=new Set(["indexed"]),cB=new Set(["calldata","memory","storage"])});var fB,pB,bL=H(()=>{oE();fB=class extends dn{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}},pB=class extends dn{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}});var EB,hB,mB,gB,CB,wL=H(()=>{oE();EB=class extends dn{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}},hB=class extends dn{constructor({param:e,name:t}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${t}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}},mB=class extends dn{constructor({param:e,type:t,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${t?` in "${t}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}},gB=class extends dn{constructor({param:e,type:t,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${t?` in "${t}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}},CB=class extends dn{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}});var ic,AB,vB,BL=H(()=>{oE();ic=class extends dn{constructor({signature:e,type:t}){super(`Invalid ${t} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}},AB=class extends dn{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}},vB=class extends dn{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}});var yB,iou=H(()=>{oE();yB=class extends dn{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}});var bB,oou=H(()=>{oE();bB=class extends dn{constructor({current:e,depth:t}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${t>0?"opening":"closing"} parentheses.`],details:`Depth "${t}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}});function sou(u,e){return e?`${e}:${u}`:u}var wB,aou=H(()=>{wB=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]])});function lou(u,e={}){if(Qiu(u)){let t=$iu(u);if(!t)throw new ic({signature:u,type:"function"});let r=ha(t.parameters),n=[],i=r.length;for(let a=0;a{xm();bL();wL();BL();oou();aou();dB();uQu=/^(?[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,eQu=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,tQu=/^u?int$/;rQu=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/});function cou(u){let e={},t=u.length;for(let s=0;s{xm();bL();wL();BL();iou();dB();DL();oQu=/^(?[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/});function BB(u){let e=cou(u),t=[],r=u.length;for(let n=0;n{dB();fou();DL()});var _L=H(()=>{Uiu();pou()});function Eou(u){let e=!0,t="",r=0,n="",i=!1;for(let s=0;s{he()});var mou,gou=H(()=>{_L();hou();mou=u=>{let e=typeof u=="string"?u:yL(u);return Eou(e)}});function xB(u){return Tiu(mou(u))}var FL=H(()=>{Oiu();gou()});var aE,DB=H(()=>{FL();aE=xB});var lE,_B=H(()=>{y6();FL();lE=u=>Xl(xB(u),0,4)});function os(u){let{abi:e,args:t=[],name:r}=u,n=$t(r,{strict:!1}),i=e.filter(a=>n?a.type==="function"?lE(a)===r:a.type==="event"?aE(a)===r:!1:"name"in a&&a.name===r);if(i.length===0)return;if(i.length===1)return i[0];let s;for(let a of i){if(!("inputs"in a))continue;if(!t||t.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==t.length)continue;if(t.every((c,d)=>{let f="inputs"in a&&a.inputs[d];return f?kL(c,f):!1})){if(s&&"inputs"in s&&s.inputs){let c=Cou(a.inputs,s.inputs,t);if(c)throw new Wb({abiItem:a,type:c[0]},{abiItem:s,type:c[1]})}s=a}}return s||i[0]}function kL(u,e){let t=typeof u,r=e.type;switch(r){case"address":return ve(u,{strict:!1});case"bool":return t==="boolean";case"function":return t==="string";case"string":return t==="string";default:return r==="tuple"&&"components"in e?Object.values(e.components).every((n,i)=>kL(Object.values(u)[i],n)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?t==="number"||t==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?t==="string"||u instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(u)&&u.every(n=>kL(n,{...e,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Cou(u,e,t){for(let r in u){let n=u[r],i=e[r];if(n.type==="tuple"&&i.type==="tuple"&&"components"in n&&"components"in i)return Cou(n.components,i.components,t[r]);let s=[n.type,i.type];if(s.includes("address")&&s.includes("bytes20")?!0:s.includes("address")&&s.includes("string")?ve(t[r],{strict:!1}):s.includes("address")&&s.includes("bytes")?ve(t[r],{strict:!1}):!1)return s}}var J6=H(()=>{Dn();Y4();Io();DB();_B()});function ss(u){let{abi:e,args:t,functionName:r,data:n}=u,i=e[0];if(r){let a=os({abi:e,args:t,name:r});if(!a)throw new j2(r,{docsPath:SL});i=a}if(i.type!=="function")throw new j2(void 0,{docsPath:SL});if(!i.outputs)throw new qb(i.name,{docsPath:SL});let s=$6(i.outputs,n);if(s&&s.length>1)return s;if(s&&s.length===1)return s[0]}var SL,Y6=H(()=>{Dn();oB();J6();SL="/docs/contract/decodeFunctionResult"});function vou(u){let{abi:e,args:t,functionName:r}=u,n=e[0];if(r){let i=os({abi:e,args:t,name:r});if(!i)throw new j2(r,{docsPath:Aou});n=i}if(n.type!=="function")throw new j2(void 0,{docsPath:Aou});return{abi:[n],functionName:lE($i(n))}}var Aou,you=H(()=>{Dn();_B();A6();J6();Aou="/docs/contract/encodeFunctionData"});function Hr(u){let{args:e}=u,{abi:t,functionName:r}=u.abi.length===1&&u.functionName?.startsWith("0x")?u:vou(u),n=t[0],i=r,s="inputs"in n&&n.inputs?g4(n.inputs,e??[]):void 0;return Wr([i,s??"0x"])}var d3=H(()=>{So();V2();you()});function as({blockNumber:u,chain:e,contract:t}){let r=e?.contracts?.[t];if(!r)throw new k6({chain:e,contract:{name:t}});if(u&&r.blockCreated&&r.blockCreated>u)throw new k6({blockNumber:u,chain:e,contract:{name:t,blockCreated:r.blockCreated}});return r.address}var X6=H(()=>{S6()});var FB,bou,wou,kB=H(()=>{FB={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},bou={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},wou={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"}});function SB(u){let{abi:e,data:t}=u,r=Xl(t,0,4);if(r==="0x")throw new t3;let i=[...e||[],bou,wou].find(s=>s.type==="error"&&r===lE($i(s)));if(!i)throw new bp(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:i,args:"inputs"in i&&i.inputs&&i.inputs.length>0?$6(i.inputs,Xl(t,4)):void 0,errorName:i.name}}var IL=H(()=>{kB();Dn();y6();_B();oB();A6()});function ML({abiItem:u,args:e,includeFunctionName:t=!0,includeName:r=!1}){if("name"in u&&"inputs"in u&&u.inputs)return`${t?u.name:""}(${u.inputs.map((n,i)=>`${r&&n.name?`${n.name}: `:""}${typeof e[i]=="object"?Xe(e[i]):e[i]}`).join(", ")})`}var Bou=H(()=>{Ro()});var u9,oc,o1,Dm,_m,sc,s1=H(()=>{Yi();kB();IL();A6();Bou();J6();Dw();kp();Dn();he();sL();fa();Mw();u9=class extends vu{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:s,gasPrice:a,maxFeePerGas:l,maxPriorityFeePerGas:c,nonce:d,to:f,value:h,stateOverride:g}){let v=t?Et(t):void 0,D=I6({from:v?.address,to:f,value:typeof h<"u"&&`${Lp(h)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:s,gasPrice:typeof a<"u"&&`${cn(a)} gwei`,maxFeePerGas:typeof l<"u"&&`${cn(l)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${cn(c)} gwei`,nonce:d});g&&(D+=`
${Ciu(g)}`),super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",D].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}},oc=class extends vu{constructor(e,{abi:t,args:r,contractAddress:n,docsPath:i,functionName:s,sender:a}){let l=os({abi:t,args:r,name:s}),c=l?ML({abiItem:l,args:r,includeFunctionName:!1,includeName:!1}):void 0,d=l?$i(l,{includeName:!0}):void 0,f=I6({address:n&&liu(n),function:d,args:c&&c!=="()"&&`${[...Array(s?.length??0).keys()].map(()=>" ").join("")}${c}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${s}".`,{cause:e,docsPath:i,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],f&&"Contract Call:",f].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=t,this.args=r,this.cause=e,this.contractAddress=n,this.functionName=s,this.sender=a}},o1=class extends vu{constructor({abi:e,data:t,functionName:r,message:n}){let i,s,a,l;if(t&&t!=="0x")try{s=SB({abi:e,data:t});let{abiItem:d,errorName:f,args:h}=s;if(f==="Error")l=h[0];else if(f==="Panic"){let[g]=h;l=FB[g]}else{let g=d?$i(d,{includeName:!0}):void 0,v=d&&h?ML({abiItem:d,args:h,includeFunctionName:!1,includeName:!1}):void 0;a=[g?`Error: ${g}`:"",v&&v!=="()"?` ${[...Array(f?.length??0).keys()].map(()=>" ").join("")}${v}`:""]}}catch(d){i=d}else n&&(l=n);let c;i instanceof bp&&(c=i.signature,a=[`Unable to decode signature "${c}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${c}.`]),super(l&&l!=="execution reverted"||c?[`The contract function "${r}" reverted with the following ${c?"signature":"reason"}:`,l||c].join(`
`):`The contract function "${r}" reverted.`,{cause:i,metaMessages:a,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=s,this.reason=l,this.signature=c}},Dm=class extends vu{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}},_m=class extends vu{constructor({factory:e}){super(`Deployment for counterfactual contract call failed${e?` for factory "${e}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}},sc=class extends vu{constructor({data:e,message:t}){super(t||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}});function cE(u,e){if(!(u instanceof vu))return!1;let t=u.walk(r=>r instanceof o1);return t instanceof o1?!!(t.data?.errorName==="ResolverNotFound"||t.data?.errorName==="ResolverWildcardNotSupported"||t.data?.errorName==="ResolverNotContract"||t.data?.errorName==="ResolverError"||t.data?.errorName==="HttpError"||t.reason?.includes("Wildcard on non-extended resolvers is not supported")||e==="reverse"&&t.reason===FB[50]):!1}var IB=H(()=>{kB();he();s1()});function MB(u){if(u.length!==66||u.indexOf("[")!==0||u.indexOf("]")!==65)return null;let e=`0x${u.slice(1,65)}`;return $t(e)?e:null}var RL=H(()=>{Y4()});function dE(u){let e=new Uint8Array(32).fill(0);if(!u)return He(e);let t=u.split(".");for(let r=t.length-1;r>=0;r-=1){let n=MB(t[r]),i=n?nn(n):pt(ia(t[r]),"bytes");e=pt(Ji([e,i]),"bytes")}return He(e)}var TL=H(()=>{So();Cr();L0();us();RL()});function xou(u){return`[${u.slice(2)}]`}var Dou=H(()=>{});function _ou(u){let e=new Uint8Array(32).fill(0);return u?MB(u)||pt(ia(u)):He(e)}var Fou=H(()=>{Cr();L0();us();RL()});function a1(u){let e=u.replace(/^\.|\.$/gm,"");if(e.length===0)return new Uint8Array(1);let t=new Uint8Array(ia(e).byteLength+2),r=0,n=e.split(".");for(let i=0;i255&&(s=ia(xou(_ou(n[i])))),t[r]=s.length,t.set(s,r+1),r+=s.length+1}return t.byteLength!==r+1?t.slice(0,r+1):t}var Fm=H(()=>{Cr();Dou();Fou()});function ma(u,{abi:e,address:t,args:r,docsPath:n,functionName:i,sender:s}){let{code:a,data:l,message:c,shortMessage:d}=u instanceof sc?u:u instanceof vu?u.walk(h=>"data"in h)||u.walk():{},f=u instanceof t3?new Dm({functionName:i}):[sQu,s3.code].includes(a)&&(l||c||d)?new o1({abi:e,data:typeof l=="object"?l.data:l,functionName:i,message:d??c}):u;return new oc(f,{abi:e,args:r,contractAddress:t,docsPath:n,functionName:i,sender:s})}var sQu,fE=H(()=>{Dn();he();s1();Wp();sQu=3});var kou,Sou=H(()=>{kou="0x82ad56cb"});var Iou,Mou,Rou,OL=H(()=>{Iou="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Mou="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Rou="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572"});function Tou(u,{docsPath:e,...t}){let r=(()=>{let n=Hp(u,t);return n instanceof o3?u:n})();return new u9(r,{docsPath:e,...t})}var Oou=H(()=>{s1();u1();Rw()});function RB({fn:u,id:e,shouldSplitBatch:t,wait:r=0,sort:n}){let i=async()=>{let d=l();s();let f=d.map(({args:h})=>h);f.length!==0&&u(f).then(h=>{n&&Array.isArray(h)&&h.sort(n);for(let g=0;g{for(let g=0;gPL.delete(e),a=()=>l().map(({args:d})=>d),l=()=>PL.get(e)||[],c=d=>PL.set(e,[...l(),d]);return{flush:s,async schedule(d){let f={},h=new Promise((D,F)=>{f.resolve=D,f.reject=F});return t?.([...a(),d])&&i(),l().length>0?(c({args:d,pendingPromise:f}),h):(c({args:d,pendingPromise:f}),setTimeout(i,r),h)}}}var PL,NL=H(()=>{PL=new Map});var TB,OB,PB,Pou=H(()=>{Ro();he();Mw();TB=class extends vu{constructor({callbackSelector:e,cause:t,data:r,extraData:n,sender:i,urls:s}){super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],t.metaMessages?.length?"":[],"Offchain Gateway Call:",s&&[" Gateway URL(s):",...s.map(a=>` ${M6(a)}`)],` Sender: ${i}`,` Data: ${r}`,` Callback selector: ${e}`,` Extra data: ${n}`].flat(),name:"OffchainLookupError"})}},OB=class extends vu{constructor({result:e,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${M6(t)}`,`Response: ${Xe(e)}`],name:"OffchainLookupResponseMalformedError"})}},PB=class extends vu{constructor({sender:e,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${e}`],name:"OffchainLookupSenderMismatchError"})}}});function l1(u,e){if(!ve(u,{strict:!1}))throw new Ye({address:u});if(!ve(e,{strict:!1}))throw new Ye({address:e});return u.toLowerCase()===e.toLowerCase()}var km=H(()=>{X4();Io()});var jou={};Mu(jou,{ccipRequest:()=>Lou,offchainLookup:()=>lQu,offchainLookupAbiItem:()=>Nou,offchainLookupSignature:()=>aQu});async function lQu(u,{blockNumber:e,blockTag:t,data:r,to:n}){let{args:i}=SB({data:r,abi:[Nou]}),[s,a,l,c,d]=i,{ccipRead:f}=u,h=f&&typeof f?.request=="function"?f.request:Lou;try{if(!l1(n,s))throw new PB({sender:s,to:n});let g=await h({data:l,sender:s,urls:a}),{data:v}=await f3(u,{blockNumber:e,blockTag:t,data:Ji([c,g4([{type:"bytes"},{type:"bytes"}],[g,d])]),to:n});return v}catch(g){throw new TB({callbackSelector:c,cause:g,data:r,extraData:d,sender:s,urls:a})}}async function Lou({data:u,sender:e,urls:t}){let r=new Error("An unknown error occurred.");for(let n=0;n{pE();Pou();qp();IL();V2();km();So();Y4();Ro();aQu="0x556f1830",Nou={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]}});async function f3(u,e){let{account:t=u.account,batch:r=!!u.batch?.multicall,blockNumber:n,blockTag:i="latest",accessList:s,blobs:a,code:l,data:c,factory:d,factoryData:f,gas:h,gasPrice:g,maxFeePerBlobGas:v,maxFeePerGas:D,maxPriorityFeePerGas:F,nonce:w,to:x,value:M,stateOverride:T,...L}=e,j=t?Et(t):void 0;if(l&&(d||f))throw new vu("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&x)throw new vu("Cannot provide both `code` & `to` as parameters.");let P=l&&c,z=d&&f&&x&&c,U=P||z,V=P?fQu({code:l,data:c}):z?pQu({data:c,factory:d,factoryData:f,to:x}):c;try{a3(e);let Z=(n?Zu(n):void 0)||i,E=Hw(T),m=u.chain?.formatters?.transactionRequest?.format,_=(m||rc)({...Vp(L,{format:m}),from:j?.address,accessList:s,blobs:a,data:V,gas:h,gasPrice:g,maxFeePerBlobGas:v,maxFeePerGas:D,maxPriorityFeePerGas:F,nonce:w,to:U?void 0:x,value:M});if(r&&cQu({request:_})&&!E)try{return await dQu(u,{..._,blockNumber:n,blockTag:i})}catch(O){if(!(O instanceof mm)&&!(O instanceof k6))throw O}let k=await u.request({method:"eth_call",params:E?[_,Z,E]:[_,Z]});return k==="0x"?{data:void 0}:{data:k}}catch(q){let Z=EQu(q),{offchainLookup:E,offchainLookupSignature:m}=await Promise.resolve().then(()=>(zou(),jou));if(u.ccipRead!==!1&&Z?.slice(0,10)===m&&x)return{data:await E(u,{data:Z,to:x})};throw U&&Z?.slice(0,10)==="0x101bb98d"?new _m({factory:d}):Tou(q,{...e,account:j,chain:u.chain})}}function cQu({request:u}){let{data:e,to:t,...r}=u;return!(!e||e.startsWith(kou)||!t||Object.values(r).filter(n=>typeof n<"u").length>0)}async function dQu(u,e){let{batchSize:t=1024,wait:r=0}=typeof u.batch?.multicall=="object"?u.batch.multicall:{},{blockNumber:n,blockTag:i="latest",data:s,multicallAddress:a,to:l}=e,c=a;if(!c){if(!u.chain)throw new mm;c=as({blockNumber:n,chain:u.chain,contract:"multicall3"})}let f=(n?Zu(n):void 0)||i,{schedule:h}=RB({id:`${u.uid}.${f}`,wait:r,shouldSplitBatch(D){return D.reduce((w,{data:x})=>w+(x.length-2),0)>t*2},fn:async D=>{let F=D.map(M=>({allowFailure:!0,callData:M.data,target:M.to})),w=Hr({abi:wm,args:[F],functionName:"aggregate3"}),x=await u.request({method:"eth_call",params:[{data:w,to:c},f]});return ss({abi:wm,args:[F],functionName:"aggregate3",data:x||"0x"})}}),[{returnData:g,success:v}]=await h({data:s,to:l});if(!v)throw new sc({data:g});return g==="0x"?{data:void 0}:{data:g}}function fQu(u){let{code:e,data:t}=u;return b6({abi:BB(["constructor(bytes, bytes)"]),bytecode:Iou,args:[e,t]})}function pQu(u){let{data:e,factory:t,factoryData:r,to:n}=u;return b6({abi:BB(["constructor(address, bytes, address, bytes)"]),bytecode:Mou,args:[n,e,t,r]})}function EQu(u){if(!(u instanceof vu))return;let e=u.walk();return typeof e?.data=="object"?e.data?.data:e.data}var pE=H(()=>{_L();Yi();Q6();Sou();OL();he();S6();s1();Y6();rw();d3();X6();L0();Oou();Tw();V6();NL();aL();Gp()});async function Vr(u,e){let{abi:t,address:r,args:n,functionName:i,...s}=e,a=Hr({abi:t,args:n,functionName:i});try{let{data:l}=await s0(u,f3,"call")({...s,data:a,to:r});return ss({abi:t,args:n,functionName:i,data:l||"0x"})}catch(l){throw ma(l,{abi:t,address:r,args:n,docsPath:"/docs/contract/readContract",functionName:i})}}var p3=H(()=>{Y6();d3();fE();Mt();pE()});async function Uou(u,{blockNumber:e,blockTag:t,coinType:r,name:n,gatewayUrls:i,strict:s,universalResolverAddress:a}){let l=a;if(!l){if(!u.chain)throw new Error("client chain not configured. universalResolverAddress is required.");l=as({blockNumber:e,chain:u.chain,contract:"ensUniversalResolver"})}try{let c=Hr({abi:gL,functionName:"addr",...r!=null?{args:[dE(n),BigInt(r)]}:{args:[dE(n)]}}),d={address:l,abi:iB,functionName:"resolve",args:[Gu(a1(n)),c],blockNumber:e,blockTag:t},f=s0(u,Vr,"readContract"),h=i?await f({...d,args:[...d.args,i]}):await f(d);if(h[0]==="0x")return null;let g=ss({abi:gL,args:r!=null?[dE(n),BigInt(r)]:void 0,functionName:"addr",data:h[0]});return g==="0x"||qr(g)==="0x00"?null:g}catch(c){if(s)throw c;if(cE(c,"resolve"))return null;throw c}}var qou=H(()=>{Q6();Y6();d3();X6();L2();L0();IB();TL();Fm();Mt();p3()});var NB,c1,EE,LB,Wou=H(()=>{he();NB=class extends vu{constructor({data:e}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(e)}`],name:"EnsAvatarInvalidMetadataError"})}},c1=class extends vu{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`,{name:"EnsAvatarInvalidNftUriError"})}},EE=class extends vu{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}},LB=class extends vu{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}});async function AQu(u){try{let e=await fetch(u,{method:"HEAD"});return e.status===200?e.headers.get("content-type")?.startsWith("image/"):!1}catch(e){return typeof e=="object"&&typeof e.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(t=>{let r=new Image;r.onload=()=>{t(!0)},r.onerror=()=>{t(!1)},r.src=u})}}function Hou(u,e){return u?u.endsWith("/")?u.slice(0,-1):u:e}function LL({uri:u,gatewayUrls:e}){let t=gQu.test(u);if(t)return{uri:u,isOnChain:!0,isEncoded:t};let r=Hou(e?.ipfs,"https://ipfs.io"),n=Hou(e?.arweave,"https://arweave.net"),i=u.match(hQu),{protocol:s,subpath:a,target:l,subtarget:c=""}=i?.groups||{},d=s==="ipns:/"||a==="ipns/",f=s==="ipfs:/"||a==="ipfs/"||mQu.test(u);if(u.startsWith("http")&&!d&&!f){let g=u;return e?.arweave&&(g=u.replace(/https:\/\/arweave.net/g,e?.arweave)),{uri:g,isOnChain:!1,isEncoded:!1}}if((d||f)&&l)return{uri:`${r}/${d?"ipns":"ipfs"}/${l}${c}`,isOnChain:!1,isEncoded:!1};if(s==="ar:/"&&l)return{uri:`${n}/${l}${c||""}`,isOnChain:!1,isEncoded:!1};let h=u.replace(CQu,"");if(h.startsWith("